Code

Opened 6 years ago

Closed 6 years ago

#8240 closed (invalid)

settings no longer availiable in urls.py

Reported by: mackenzie@… Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

the edit of /django/core/management/init.py in [8282]
has made it so that settings are no longer available in a urls.py

settings.py

MEDIA_ROOT = '/media/'

urls.py

from django.conf.urls.defaults import *
from django.conf import settings

urlpatterns = patterns('',
    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)

this setup will always give a 404 when you try to view the static media. It is not the view but settings.MEDIA_ROOT is not accessible. any of the settings can not be accessed.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mtredinnick

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

As noted on the mailing list, Karen Tracey has tried this exact example and it works. I just tried a completely unrelated project, imported settings into my url config and printed out settings.MEDIA_ROOT and it worked (using [8309]). So this doesn't seem to be a problem. I think there's something else going on at your end here.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.