Hi all,
I don't understand something about DJANGO_SETTINGS_MODULE. My
intention is to serve several websites from the same project
installation, by creating a subdir of website-specific settings.
project_root/
settings.py
client_settings/
__init__.py
foo.py
bar.py
etc ....
So if foo.py contains::
from settings import *
HELLO=True
I'm expecting django.conf.settings.HELLO to be True from a shell spawned with::
DJANGO_SETTINGS_MODULE='client_settings.foo' ./manage.py shell
But the result is:
>>> echo $DJANGO_SETTINGS_MODULE
client_settings.foo
>>> ./manage.py shell
In [1]: from django.conf import settings
In [2]: settings.HELLO
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/srv/art/art_crm/<ipython-input-2-fdf854136b11> in <module>()
----> 1 settings.HELLO
/srv/art/art_env/lib/python2.7/site-packages/django/utils/functional.pyc
in __getattr__(self, name)
275 if self._wrapped is None:
276 self._setup()
--> 277 return getattr(self._wrapped, name)
278
279 def __setattr__(self, name, value):
AttributeError: 'Settings' object has no attribute 'HELLO'
My manage.py should be the default:
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the
directory containing %r. It appears you've customized things.\nYou'll
have to run django-admin.py, passing it your settings module.\n" %
__file__)
sys.exit(1)
import settings
if __name__ == "__main__":
execute_manager(settings)
What am I doing wrong ?
--
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en.