diff --git a/app.py b/app.py index c8e91b8..35ba108 100644 --- a/app.py +++ b/app.py @@ -42,9 +42,8 @@ if not lessons: print("Keine Lektionen verfügbar, verwende Fallback-Lektionen") lessons = FALLBACK_LESSONS -@app.before_first_request -def create_tables(): - """Erstelle Datenbanktabellen beim ersten Request""" +# Datenbanktabellen erstellen +with app.app_context(): db.create_all() print("Datenbanktabellen wurden initialisiert") @@ -243,9 +242,7 @@ def end_session(): if __name__ == '__main__': with app.app_context(): - db.create_all() print("Datenbank initialisiert") print(f"{len(lessons)} Lektionen geladen") app.run(debug=True) -