Thanks.  That's exactly what I need.  My dynamic settings needs are
not really that dynamic.  I haven't had a chance to read up on the
various environment variables.  Looks like that's what I'll be doing
next.

Regards,

-Brian

On 10/13/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
> On 10/13/07, Brian DeGeeter <[EMAIL PROTECTED]> wrote:
> >
> > So looks like there is no easy answer to my dynamic db settings.  I'd
> > be interested in the complex answer if anyone has one.  Specifically
> > for the command line tool we have.  Editing the settings.py with a sed
> > script seems so crude.
>
> It depends on exactly what you mean by 'dynamic'. If you mean 'changes
> during execution', then the answer will generally be no. However, your
> comment about using sed to modify settings.py suggests that you really
> mean something like 'changes depending upon the context in which it is
> accessed'.
>
> If the latter is what you mean, you should remember that :
> 1) Your settings file doesn't need to be called 'settings.py'. Django
> uses the DJANGO_SETTINGS_FILE environment variable and the --settings
> option on manage.py to load settings
>
> 2) Django settings files are just python files.
>
> As a result, the following setup:
>
> base_settings.py
> -----------------------
>
> INSTALLED_APPS=(...)
>
> database1_settings.py
> --------------------
>
> from base_settings import *
>
> DATABASE_BACKEND='sqlite3'
> DATABASE_NAME='foo'
>
> database2_settings.py
> --------------------
>
> from base_settings import *
>
> DATABASE_BACKEND='sqlite3'
> DATABASE_NAME='bar'
>
> is entirely legal; there's no need to use sed - just factor out the
> common settings, and direct manage.py (or whatever other script you
> are using) to point at the appropriate settings file at time of
> execution.
>
> Yours,
> Russ Magee %-)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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