On Tue, Nov 15, 2011 at 4:42 PM, James Pic <[email protected]> wrote:
> 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
>
>…
>
> What am I doing wrong ?
>

Two things:

1) You are setting things in settings from outside of settings. That
is forbidden.

https://docs.djangoproject.com/en/1.3/topics/settings/#altering-settings-at-runtime

2) You are importing settings directly, you must import settings from
django.conf.

https://docs.djangoproject.com/en/1.3/topics/settings/#using-settings-in-python-code

If you want settings to be built up from code in other modules, you
must import those modules into settings, not import settings from
those modules. For example, this construct is commonly used in
settings.py for importing project default settings:

try:
  from project_default_settings import *
except ImportError:
  pass # ok not to have defaults


Cheers

Tom

-- 
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.

Reply via email to