From 1cb64f759442e6c4e38cf8726e3cbf6d0e5e9abb Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sat, 12 Mar 2022 20:38:24 -0600 Subject: [PATCH] adjust init an settings to line up with file --- app/__init__.py | 16 +++++++++++++--- app/settings.exmaple.py | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 93227f2..e2350a7 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -173,15 +173,25 @@ def register_settings(app): """ # Load common settings - app.config.from_object('app.settings') + try: + app.config.from_object('app.settings') + except Exception: + # Load environment specific settings app.config['TESTING'] = False app.config['DEBUG'] = False # always pull these two from the env - app.config['SECRET_KEY'] = os.getenv('APP_SECRET_KEY') - app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('APP_DATABASE_URI') + app.config['SECRET_KEY'] = os.getenv( + 'APP_SECRET_KEY', + app.config['APP_SECRET_KEY'] + + ) + app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv( + 'APP_DATABASE_URI', + app.config['APP_DATABASE_URI'] + ) # try to get overides, otherwise just use what we have already app.config['USER_ENABLE_REGISTER'] = os.getenv( diff --git a/app/settings.exmaple.py b/app/settings.exmaple.py index 35f67e5..f42a4c7 100644 --- a/app/settings.exmaple.py +++ b/app/settings.exmaple.py @@ -4,6 +4,9 @@ APP_NAME = "Nexus Dashboard" APP_SYSTEM_ERROR_SUBJECT_LINE = APP_NAME + " system error" +APP_SECRET_KEY = "" +APP_DATABASE_URI = "" + # Send Analytics for Developers to better fix issues ALLOW_ANALYTICS = False