Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4792 closed (invalid)

Serving Static Files Documentation

Reported by: johnwyand@… Owned by: Jacob
Component: Documentation Version: master
Severity: Keywords: static files
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The serving static files documentation here doesn't mention that the pattern to be added to Urlconf has to be placed as the first pattern.

Examples:

#Won't work:
urlpatterns = patterns('',
    (r'^/articles/2003/$', 'news.views.special_case_2003'),
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}),
)

#Will work:
urlpatterns = patterns('',
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}),
    (r'^/articles/2003/$', 'news.views.special_case_2003'),
)

Change History (2)

comment:1 Changed 9 years ago by Paul Bx

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed

It doesn't have to be first. I'm guessing you have a hungry URL pattern somewhere before it (in your actual URLconf, not this made-up example one). Ask for help on the IRC channel or the django-users list and ye shall receive.

comment:2 in reply to:  1 Changed 9 years ago by johnwyand@…

Replying to Paul Bx:

It doesn't have to be first. I'm guessing you have a hungry URL pattern somewhere before it (in your actual URLconf, not this made-up example one). Ask for help on the IRC channel or the django-users list and ye shall receive.

You're right, the problem was exactly as you described. Sorry for submitting the unnecessary ticket.

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