did some code cleanup

This commit is contained in:
eclipse 2025-04-28 10:24:15 +02:00
parent 3c130482d1
commit 5093bdd6cd

View File

@ -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)