app_context: Benutzung von with statt pop

This commit is contained in:
2021-08-13 23:43:41 +02:00
parent e577a33758
commit 3b9f0897a0
+1 -1
View File
@@ -75,6 +75,7 @@ def create_app() -> Flask:
db.init_app(app)
db.create_all(app=app)
with app.app_context():
init_db(app)
# Blueprints registrieren
@@ -150,7 +151,6 @@ def setup_syslog(app: Flask):
def init_db(app: Flask):
""" Initialisiert Stufen und Administratorkonto, falls nicht vorhanden """
app.app_context().push()
if Stufe.query.count() == 0:
new_stufen_namen = ["EF", "Q1", "Q2"]
for stufe_name in new_stufen_namen: