From f0faa4c53bec2d05462e1be23200679fa329e234 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sun, 13 Mar 2022 19:27:23 -0500 Subject: [PATCH] fallback to example settings if no setting file is given --- app/__init__.py | 6 ++++-- app/{settings.exmaple.py => settings_example.py} | 0 2 files changed, 4 insertions(+), 2 deletions(-) rename app/{settings.exmaple.py => settings_example.py} (100%) diff --git a/app/__init__.py b/app/__init__.py index dbc4cac..17d606a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -176,7 +176,8 @@ def register_settings(app): try: app.config.from_object('app.settings') except Exception: - print("Not using settings.py") + app.logger.info("No settings.py, loading from example") + app.config.from_object('app.settings_example') # Load environment specific settings app.config['TESTING'] = False @@ -192,7 +193,8 @@ def register_settings(app): 'APP_DATABASE_URI', app.config['APP_DATABASE_URI'] ) - + if app.config['SECRET_KEY'] is None or app.config['APP_DATABASE_URI'] is None: + raise("No database uri or secret Key") # try to get overides, otherwise just use what we have already app.config['USER_ENABLE_REGISTER'] = os.getenv( 'USER_ENABLE_REGISTER', diff --git a/app/settings.exmaple.py b/app/settings_example.py similarity index 100% rename from app/settings.exmaple.py rename to app/settings_example.py