Opened 17 years ago
Closed 17 years ago
#4436 closed (wontfix)
./manage.py overwrites DJANGO_SETTINGS_MODULE EnvVar
Reported by: | Uz | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 0.96 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.core.management.setup_environ overwrites this EnvVar with <project_name>.settings even if already set with something meaningful.
Attachments (1)
Change History (6)
comment:1 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 4 comment:2 by , 17 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Triage Stage: | Unreviewed → Design decision needed |
Actually, perhaps you are right and manage.py
should leave DJANGO_SETTINGS_MODULE
alone if it's already set.
It would be a change in functionality, but I'll leave as a design decision.
comment:3 by , 17 years ago
The current documentation advises to use the DJANGO_SETTINGS_MODULE
environment variable and mentions --settings
as an alternative.
Also, it's not clear how to specify the settings file for separate Python scripts which use Django and the database. Previously I was able to do this using the DJANGO_SETTINGS_MODULE
environment variable, but that's broken now.
All this on SVN. Was this really broken already in 0.96?
comment:4 by , 17 years ago
Replying to SmileyChris:
It would be a change in functionality, but I'll leave as a design decision.
The documentation states that:
manage.py is a thin wrapper around django-admin.py that takes care of two things for you before delegating to django-admin.py:
- It puts your project’s package on sys.path.
- It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file.
While (1) is undoubtedly useful, the (2) IMHO is at least confusing, because while django-admin is smart enough to pick up the user-defined env-var 'DJANGO_SETTINGS_MODULE', 'manage.py' simply disables the feature.
a) the env-var 'DJANGO_SETTINGS_MODULE' let us avoid typing 'django-admin --settings=...' => saves time => good feature
b) manage.py wrapper let us avoid adding project dir to python sys path => saves time => good feature
What is not good is that ATM these two features simply do not work together.
Please count my vote for restoring the old functionality of manage.py (i.e.make manage.py account for 'DJANGO_SETTINGS_MODULE' and not simply override it with settings).
I'll attach a tiny patch that does what this ticket requests - it's merely a copy-paste from django.conf.
by , 17 years ago
Attachment: | django_manage.patch added |
---|
Patch that let manage.py script to first pick up DJANGO_SETTINGS_MODULE environment variable before falling back to 'settings' module.
comment:5 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Marking wontfix because:
1) It's often useful to have manage.py
override so you can work with a different project for a little while, and
2) The --settings
option lets you avoid this.
That's what the
--settings
option is for:http://www.djangoproject.com/documentation/django-admin/#settings