Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#26631 closed Bug (worksforme)

Tutorial Part 6: Lacking import static for static files

Reported by: donkeyDau Owned by: nobody
Component: Documentation Version: 1.9
Severity: Normal Keywords: tutorial
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the tutorial in step 6 (https://docs.djangoproject.com/en/1.9/intro/tutorial06/) the following code is used:

{% load staticfiles %}

<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />

It wouldn't work when I tried. I figured out that I have to import

from django.conf.urls.static import static

to get it work properly.

Change History (2)

comment:1 Changed 4 years ago by Tim Graham

Resolution: worksforme
Status: newclosed

What error do you get? Where do you add the import? Perhaps you've made some mistake as the tutorial works fine for me.

comment:2 Changed 4 years ago by donkeyDau

I don't get a direct error. But the stylesheet style.css is not loaded as it's url is missing a "static/" at the start. With the import of

from django.conf.urls.static import static

the "static/" appears.

Note: See TracTickets for help on using tickets.
Back to Top