Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4792 closed (invalid)

Serving Static Files Documentation

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

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 by Paul Bx, 17 years ago

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.

in reply to:  1 comment:2 by johnwyand@…, 17 years ago

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