#15064: DJANGO_SETTINGS_MODULE doesn't work with runserver
---------------------------+------------------------------------------------
Reporter: olau | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
The help for --settings claims that one can use DJANGO_SETTINGS_MODULE to
specify the settings module as an alternative to --settings. This seems to
be wrong on two accounts, first it works even without a
DJANGO_SETTINGS_MODULE (since it guesses settings.py), second setting
DJANGO_SETTINGS_MODULE doesn't seem to have any effect at all with
runserver.
If I try "DJANGO_SETTINGS_MODULE=alternative_settings python manage.py
runserver" with a print in alternative_settings.py, I never get the print.
The culprit seems to be setup_environ in django.core.__init__.py:
{{{
# Set DJANGO_SETTINGS_MODULE appropriately.
if original_settings_path:
os.environ['DJANGO_SETTINGS_MODULE'] = original_settings_path
else:
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.%s' % (project_name,
settings_name)
}}}
This always overwrites the environment variable; if I delete those lines,
my alternative_settings.py are imported. I guess the correct fix is
checking that DJANGO_SETTINGS_MODULE isn't set before overwriting it.
--
Ticket URL: <http://code.djangoproject.com/ticket/15064>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.