Opened 17 years ago
Closed 17 years ago
#5201 closed (invalid)
Settings won't load when inside a directory named settings
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I think something has happened since the refatoring of management so that you can no longer have a directory named settings which contains your settings files. For example, I have a directory on my PYTHONPATH which has all my apps I'm working on and then a settings directory which has devel.py and apache.py inside. Something like:
devel_dir -- app1 -- app2 -- settings -- devel.py -- apache.py
Normally, I run the with DJANGO_SETTINGS_MODULE=settings.devel, but I noticed today that this no longer works.
See this Traceback that might help explain and also shows this worked with a SVN rev prior to r5898
naminanu:~ hodgedg$ export PYTHONPATH=~/projects/django_trunk_r5897:~/projects/paperlate naminanu:~ hodgedg$ export DJANGO_SETTINGS_MODULE=settings.devel naminanu:~ hodgedg$ django-admin.py validate 0 errors found. naminanu:~ hodgedg$ export PYTHONPATH=~/projects/django/SVN/django/trunk:~/projects/paperlate naminanu:~ hodgedg$ export DJANGO_SETTINGS_MODULE=settings.devel naminanu:~ hodgedg$ django-admin.py validate Traceback (most recent call last): File "/Users/hodgedg/projects/django/SVN/django/trunk/django/bin/django-admin.py", line 5, in <module> management.execute_from_command_line() File "/Users/hodgedg/projects/django/SVN/django/trunk/django/core/management/__init__.py", line 171, in execute_from_command_line utility.execute(argv) File "/Users/hodgedg/projects/django/SVN/django/trunk/django/core/management/__init__.py", line 124, in execute command.execute(*args[1:], **options.__dict__) File "/Users/hodgedg/projects/django/SVN/django/trunk/django/core/management/base.py", line 28, in execute translation.activate('en-us') File "/Users/hodgedg/projects/django/SVN/django/trunk/django/utils/translation/__init__.py", line 76, in activate return real_activate(language) File "/Users/hodgedg/projects/django/SVN/django/trunk/django/utils/translation/__init__.py", line 31, in delayed_loader if settings.USE_I18N: File "/Users/hodgedg/projects/django/SVN/django/trunk/django/conf/__init__.py", line 28, in __getattr__ self._import_settings() File "/Users/hodgedg/projects/django/SVN/django/trunk/django/conf/__init__.py", line 57, in _import_settings self._target = Settings(settings_module) File "/Users/hodgedg/projects/django/SVN/django/trunk/django/conf/__init__.py", line 85, in __init__ raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) EnvironmentError: Could not import settings 'settings.devel' (Is it on sys.path? Does it have syntax errors?): No module named devel naminanu:~ hodgedg$ cp -r ~/projects/paperlate/settings/ ~/projects/paperlate/testing/ naminanu:~ hodgedg$ export DJANGO_SETTINGS_MODULE=testing.devel naminanu:~ hodgedg$ django-admin.py validate naminanu:~ hodgedg$
Notice that renaming the directory to something other than "settings" fixes the problem. Also, this Tracebook occurred in Trunk against r5919.
Okay, I feel stupid. I had added a settings.py inside django for testing which feel on my PYTHONPATH.
Please forgive the ticket noise.