On Tue, Nov 3, 2009 at 2:31 PM, Graham Dumpleton
<graham.dumple...@gmail.com> 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 here
http://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

:)

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to