Last active
January 24, 2018 09:32
-
-
Save hartred/63325e78ac9dccf044ae61a6f48796ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
import os | |
SETTINGS_MODULE = os.environ('SETTINGS_MODULE') | |
class Borg: | |
_shared_state = {} | |
def __init__(self): | |
self.__dict__ = self._shared_state | |
class Settings(Borg): | |
settings_module = None | |
def __init__(self): | |
super().__init__() | |
settings_module = importlib.import_module(SETTINGS_MODULE) | |
for setting in dir(settings_module): | |
if setting.isupper() and not getattr(self, setting): | |
setattr(self, setting, getattr(settings_module, setting)) | |
def assert_settings_errors(self): | |
raise NotImplementedError | |
settings = Settings() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment