Skip to content

Instantly share code, notes, and snippets.

@burnash
Created April 1, 2015 20:17
Show Gist options
  • Save burnash/e60351e2696f4d17a466 to your computer and use it in GitHub Desktop.
Save burnash/e60351e2696f4d17a466 to your computer and use it in GitHub Desktop.
How to extend Django settings variables with local_settings.py
# Code from Mikko Hellsing:
# http://www.robgolding.com/blog/2010/05/03/extending-settings-variables-with-local_settings-py-in-django/#comment-51863642
def get_setting(setting):
import settings
return getattr(settings, setting)
INSTALLED_APPS = get_setting('INSTALLED_APPS') + ('debug_toolbar', )
MIDDLEWARE_CLASSES = get_setting('MIDDLEWARE_CLASSES') + ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INTERNAL_IPS = ('127.0.0.1',)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment