Opened 6 years ago

Closed 6 years ago

Last modified 6 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: UI/UX:

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 Changed 6 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

"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 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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