From 54746e989f0bdac219b081513c825762fce1f0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 21 Jul 2026 07:32:19 +0400 Subject: [PATCH] fix: run init_db() at module level so it works under gunicorn too --- site/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/site/app.py b/site/app.py index 302f679..1c6aed9 100644 --- a/site/app.py +++ b/site/app.py @@ -111,7 +111,10 @@ def index(): ) +# --- Инициализация БД при старте (до первого запроса) --- +with app.app_context(): + init_db() + + if __name__ == "__main__": - with app.app_context(): - init_db() app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)), debug=False)