settings: defer SECRET_KEY until after site settings

This allows overriding just `SECRET_FILE` for a custom secret path.
This commit is contained in:
Ben Boeckel 2018-10-29 18:26:13 -04:00
parent 872af56e2c
commit e02fa53c34

View File

@ -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 # See secret.py for how this is generated; uses a file 'secret.txt' in the root
# directory # directory
SECRET_FILE = os.path.join(BASE_DIR, "secret.txt") 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! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = False
@ -142,3 +141,6 @@ try:
from etesync_site_settings import * from etesync_site_settings import *
except ImportError: except ImportError:
pass pass
if 'SECRET_KEY' not in locals():
SECRET_KEY = get_secret_from_file(SECRET_FILE)