Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#10054 closed (invalid)

Naming issue with static files in standard urlpattern

Reported by: thomas.m.magee@… 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/

Change History (2)

comment:1 by Karen Tracey, 16 years ago

Resolution: invalid
Status: newclosed

"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.

comment:2 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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