settings: use exec() to load local settings
authorFrédéric Péters <fpeters@0d.be>
Sat, 4 Apr 2020 14:06:32 +0000 (16:06 +0200)
committerFrédéric Péters <fpeters@0d.be>
Sat, 4 Apr 2020 14:06:32 +0000 (16:06 +0200)
panikweb/settings.py

index 5173478..66c43c0 100644 (file)
@@ -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 += (