django12factor: Bringing 12factor to Django
What is it?
Django is an awesome Python web framework.
“The Twelve-Factor App” is an awesome methodology for building SaaS apps.
Add the following to the bottom of your settings.py:
import django12factor d12f = django12factor.factorise()
factorise() returns a dict of settings, so you can now use and assign them as you wish, e.g.
DEBUG = d12f['DEBUG'] LOGGING = d12f['LOGGING']
If you don’t like that repetition, you can (ab)use globals() like so:
import django12factor d12f = django12factor.factorise() def f(setting): globals()[setting] = d12f[setting] f('DEBUG') f('LOGGING')
Give me everything!
If you say so…
import django12factor globals().update(django12factor.factorise())