Supplementing settings in settings_local

, , django, settings

For local project settings, I use old trick with settings_local file:

    try:
        from settings_local import *
    except ImportError:
        pass

So in settings_local.py we can override variables from settings.py. I didn't know how to supplement them. For example how to add line to INSTALLED_APPS without copying whole list.

Yesterday I finally understood that I can import settings from settings_local:

    # settings_local.py

    from settings import *

    INSTALLED_APPS += (
        # ...
    )

Update

Now, couple years later I prefer having separate settings file for different environments, as it is described in 2 scoops of django.

contact us right now