From 5093bdd6cdf1d83bc3c86aac8f5b69e425eee85b Mon Sep 17 00:00:00 2001 From: eclipse Date: Mon, 28 Apr 2025 10:24:15 +0200 Subject: [PATCH] did some code cleanup --- the_works/__init__.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/the_works/__init__.py b/the_works/__init__.py index 034e4bd..b6bdf4d 100644 --- a/the_works/__init__.py +++ b/the_works/__init__.py @@ -4,7 +4,6 @@ from flask import Flask from the_works.database import init_db from flask_debugtoolbar import DebugToolbarExtension - def create_app(): app = Flask(__name__) @@ -14,14 +13,8 @@ def create_app(): if os.getenv("SQLALCHEMY_DATABASE_DIALECT") == "sqlite": app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///" + os.path.abspath(app.root_path + "/..") + "/" + os.getenv("SQLALCHEMY_DATABASE_SQLITE_FILENAME") else: - pass + exit("no SQLite database URI given; exiting") - # DEBUG - app.config["SQLALCHEMY_ECHO"] = True - - print(f"Current Environment: " + app.config['ENVIRONMENT']) - print(f"SQLAlchemy DB URI: " + app.config['SQLALCHEMY_DATABASE_URI']) - # initialize database init_db(app) @@ -31,6 +24,9 @@ def create_app(): app.register_blueprint(home.bp) app.register_blueprint(werk.bp) + ### DEBUG + app.config["SQLALCHEMY_ECHO"] = True + print(f"Current Environment: " + app.config['ENVIRONMENT']) # load debug toolbar toolbar = DebugToolbarExtension(app)