Re: manage.py ignores DJANGO_SETTINGS_MODULE
If you read the source for django.core.management.__init__ you'll find
a function called "setup_environ. This is called by all management
commands (i.e. manage.py). If you note here the os.environ is set
unconditionally. I suppose for your setup to work correctly django
should be doing:
if not "DJANGO_SETTINGS_MODULE" in os.environ:
os.environ['DJANGO_SETTINGS_MODULE'] = ...
However, since this is not the case you don't have much choice other
then to use --settings option, or alter your manage.py file so that it
sets up this hard-coded path before it calls the main setup_environ.
Is the a particular reason to want an non-standard settings file? If
the answer is yes, then carry on. Otherwise, I'd stick to what Django
recommend.
Euan
On 5 July, 05:13, ShawnMilo <shawn.m...@gmail.com> wrote:
> I have DJANGO_SETTINGS_MODULE set in my environment to an alternative
> settings file. The alternate file imports the original settings file
> and overrides some values for my development environment.
>
> Whenever I try to run ./manage.py runserver, it insists on using the
> settings.py on the same path as manage.py, despite the fact that
> running an interactive Python interpreter or a stand-alone script
> which imports settings from django.conf will import the proper
> settings file (from DJANGO_SETTINGS_MODULE).
>
> Also, this works:
> ./manage.py runserver --settings=$DJANGO_SETTINGS_MODULE
>
> I can see in manage.py that it assumes there's a settings.py in its
> own directory, but that's evidently overridden by the --settings flag.
> Why doesn't a correctly-set DJANGO_SETTINGS_MODULE result in the same
> behavior? I'm using Django 1.1.1.
>
> Thanks,
> Shawn
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home