From: Frédéric Péters Date: Sat, 4 Apr 2020 14:06:32 +0000 (+0200) Subject: settings: use exec() to load local settings X-Git-Tag: v2021~181 X-Git-Url: https://git.0d.be/?p=panikweb.git;a=commitdiff_plain;h=cce3682b72d56867c068abaadded6601e22b43d5 settings: use exec() to load local settings --- diff --git a/panikweb/settings.py b/panikweb/settings.py index 5173478..66c43c0 100644 --- a/panikweb/settings.py +++ b/panikweb/settings.py @@ -252,10 +252,11 @@ WEBSITE_BASE_URL = 'http://www.radiopanik.org/' COMBO_INITIAL_LOGIN_PAGE_PATH = '/' COMBO_WELCOME_PAGE_PATH = None -try: - from .local_settings import * -except ImportError as e: - pass +local_settings_file = os.environ.get( + 'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py') +) +if os.path.exists(local_settings_file): + exec(open(local_settings_file).read()) if DEBUG and DEBUG_TOOLBAR: MIDDLEWARE_CLASSES += (