From e02fa53c34200de59288a16ed00fa0621a007578 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 29 Oct 2018 18:26:13 -0400 Subject: [PATCH] settings: defer SECRET_KEY until after site settings This allows overriding just `SECRET_FILE` for a custom secret path. --- etesync_server/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etesync_server/settings.py b/etesync_server/settings.py index d4b93d8..9556167 100644 --- a/etesync_server/settings.py +++ b/etesync_server/settings.py @@ -24,7 +24,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # See secret.py for how this is generated; uses a file 'secret.txt' in the root # directory SECRET_FILE = os.path.join(BASE_DIR, "secret.txt") -SECRET_KEY = get_secret_from_file(SECRET_FILE) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -142,3 +141,6 @@ try: from etesync_site_settings import * except ImportError: pass + +if 'SECRET_KEY' not in locals(): + SECRET_KEY = get_secret_from_file(SECRET_FILE)