On Nov 3, 5:55 pm, Stephen Moore <[email protected]> wrote:
> On Tue, Nov 3, 2009 at 2:31 PM, Graham Dumpleton
>
> <[email protected]> wrote:
> > Cant you just have different settings files and set
> > DJANGO_SETTINGS_MODULES different for each installation?
>
> The problem with that becomes let's say I have the two options
> production and internet, then that means that I have to have 4
> different settings.py for each combination.
>
> I did find an interesting idea 
> herehttp://www.modpython.org/pipermail/mod_python/2006-June/021316.html
> just then.
>
> basically you modify PythonPath depending on what features you want.
>
> For example, say I have a file hierarchy like so
>
> options/
>     debug/
>         production/
>             __init__.py
>             apacheSettings.py
>             #In here set PRODUCTION=True
>
>         dev/
>             __init__.py
>             apacheSettings.py
>             #In here set PRODUCTION=False
>
>     internet/
>         on/
>             __init__.py
>             apacheSettings.py
>             #In here set INTERNET=True
>
>         off/
>             __init__.py
>             apacheSettings.py
>             #In here set INTERNET=False
>
> then in settings.py
>
> PRODUCTION = True
> try:
>     import apacheSettings
>     PRODUCTION = apacheSettings.PRODUCTION
> except ImportError:
>     pass
>
> INTERNET = True
> try:
>     import internetSettings
>     INTERNET = internetSettings.INTERNET
> except ImportError:
>     pass
>
> and finally, in apache configuration
>
> PythonPath " \
>     [ \
>         '/home/iambob/web/options/debug/production', \
>         '/home/iambob/web/options/internet/on', \
>         '/home/iambob/web',  '/home/iambob/web/common', 
> '/home/iambob/web/home'\
>     ] + sys.path"
>
> or
>
> PythonPath " \
>     [ \
>         '/home/iambob/web/options/debug/dev', \
>         '/home/iambob/web/options/internet/off', \
>         '/home/iambob/web',  '/home/iambob/web/common', 
> '/home/iambob/web/home'\
>     ] + sys.path"
>
> which seems to work rather nicely
>
> :)

All I can suggest is get rid of mod_python. It is a fair bit simpler
in mod_wsgi to do these sorts of per setup overrides because the WSGI
script file acts as an intermediary from which overrides can be
applied.

Graham
--~--~---------~--~----~------------~-------~--~----~
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