Formalizing manage.py's relationship to settings.py

47 views
Skip to first unread message

graham_king

unread,
May 24, 2011, 4:09:29 AM5/24/11
to Django developers
manage.py has an ambiguous relationship to settings.py: It requires it
to be present, imports it, passes it to core.management.setup_environ,
uses it's location to set your python path, but doesn't necessarily
use it as your settings. You can override that final part via --
settings or DJANGO_SETTINGS_MODULE.

I'd like to change that relationship to be either always REQUIRED or
always OPTIONAL.

1. REQUIRED: manage.py always uses settings.py. It no longer accepts --
settings and DJANGO_SETTINGS_MODULE.
Currently manage.py exits with an warning if settings.py is not found
(the warning encourages you to use django-admin), so I think this is
the current intended behavior. This behavior also fits with the docs
at http://docs.djangoproject.com/en/dev/ref/django-admin/

2. OPTIONAL: manage.py looks in order for a --settings, then a
DJANGO_SETTINGS_MODULE, and finally a settings.py, and only imports
the first one it finds, passing that one to
core.management.setup_environ to set your path and be used as your
settings.

This is in the context of #13612.

What do you think?
Reply all
Reply to author
Forward
0 new messages