#10054 closed (invalid)
Naming issue with static files in standard urlpattern
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am using Django 1.0.2.
The Django book suggests that django users put the following in their urlconf to support static files:
(r'site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
In the development server this makes static resources accessible at http://127.0.0.1:8000/site_media/
And this works well. However, if you change "site_media" to "media" as follows:
(r'media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
The django development server responds with a 404 error for all requests to http://127.0.0.1:8000/media/
"media" is the default used by ADMIN_MEDIA_PREFIX:
http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix
So if you want to use "media" for your site media, you need to also change ADMIN_MEDIA_PREFIX to something else -- you can't use the same prefix for both admin media and your own static files.