6

How do I use different setting for each application?

For example:

etc...

Thanks,

William
  • 199
  • 3
  • 8

3 Answers3

4

you could check all ways of splitting up your settings from here: https://code.djangoproject.com/wiki/SplitSettings

Muhammad Soliman
  • 21,644
  • 6
  • 109
  • 75
1

Older relevant thread talking about per application settings:

http://groups.google.com/group/django-developers/browse_thread/thread/fc8b2e284459f6cf

You can run multiple django instances on a single domain with different settings using the advice from here:

multiple instances of django on a single domain

Community
  • 1
  • 1
dting
  • 38,604
  • 10
  • 95
  • 114
-1

It's not pretty, but you can put the following in your settings.py after INSTALLED_APPS:

PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
for app in INSTALLED_APPS:
    local_settings = os.path.join(PROJECT_DIR, app, 'local_settings.py')
    if os.path.isfile(local_settings):
        execfile(local_settings)
dgel
  • 16,352
  • 8
  • 58
  • 75
  • 1
    Doesn't this load all the local_settings instead of allowing for different settings for each app? – dting Mar 23 '11 at 19:23
  • 2
    Note- You wouldn't be able to have different namespaces for each app. Duplicate settings for each app would override eachother. – dgel Mar 23 '11 at 19:24
  • I don't know if it would be possible to have different settings for each app. – dgel Mar 23 '11 at 19:26
  • Thanks for your help but this load all the settings... I want to load only the right settings file! – William Mar 23 '11 at 19:31