Django: "split settings"...
Verfasst: Dienstag 21. August 2012, 16:01
Hab zufällig die Wiki Seite https://code.djangoproject.com/wiki/SplitSettings gesehen.
Interessant finde ich die Variante https://code.djangoproject.com/wiki/Spl ... ngsettings :
settings/__init__.py:
settings/local.py:
Finde ich recht interessant. Zumindest besser als meine aktuelle Lösung:
https://github.com/jedie/PyLucid/commit ... 44b1c4af3f
https://github.com/jedie/PyLucid-django ... ba4216f604
Zugegeben globals().update(vars(sys.modules['settings'])) sieht nach einem Hack aus, aber doch relativ klar und einfach gelöst ohne viel Magie. Was haltet ihr davon?
Interessant finde ich die Variante https://code.djangoproject.com/wiki/Spl ... ngsettings :
settings/__init__.py:
Code: Alles auswählen
INSTALLED_APPS = ('whatever',)
try:
from settings.local import *
except ImportError:
pass
Code: Alles auswählen
import sys
globals().update(vars(sys.modules['settings']))
INSTALLED_APPS += ('another_app',)
https://github.com/jedie/PyLucid/commit ... 44b1c4af3f
https://github.com/jedie/PyLucid-django ... ba4216f604
Zugegeben globals().update(vars(sys.modules['settings'])) sieht nach einem Hack aus, aber doch relativ klar und einfach gelöst ohne viel Magie. Was haltet ihr davon?