fix: run init_db() at module level so it works under gunicorn too

This commit is contained in:
2026-07-21 07:32:19 +04:00
parent 34c030c8af
commit 54746e989f
+5 -2
View File
@@ -111,7 +111,10 @@ def index():
) )
if __name__ == "__main__": # --- Инициализация БД при старте (до первого запроса) ---
with app.app_context(): with app.app_context():
init_db() init_db()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)), debug=False) app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)), debug=False)