fix: run init_db() at module level so it works under gunicorn too
This commit is contained in:
+5
-2
@@ -111,7 +111,10 @@ def index():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# --- Инициализация БД при старте (до первого запроса) ---
|
||||||
|
with app.app_context():
|
||||||
|
init_db()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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)
|
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)), debug=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user