4 ms·
We have canonical settings in our settings.py, while every environment imports local settings from another conf. If it is necessary to have subsidiary settings
by thezilch 14y ago
We have canonical settings in our settings.py, while every environment imports local settings from another conf. If it is necessary to have subsidiary settings also source controlled, we could do that and have the environment symlink its preference. Of course, additionally, the secondary settings could have the same dance as the primary settings and allow for another level of local configuration.
# allow overriding of settings with $HOME/.sodahead
rc = os.path.join(os.environ["HOME"], ".sodahead")
if os.path.isfile(rc):
with open(rc, "r") as fi:
dotsodahead = imp.load_source("dotsodahead", rc, fi)
settings = dict([(k, v) for k, v in vars(dotsodahead).items()
if not k.startswith("__")])
globals().update(settings)