Missing code to include staticfiles

If you are reading Writing your first Django app, part 6, the code won’t work until you put in the following code from https://docs.djangoproject.com/en/1.8/howto/static-files/ (in the section named Serving static files during development) to the urls.py file.

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Basically your urls.py needs to know where to route the static file requests. =)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s