From cc9b18427735e97435d811a9a41a52446d206821 Mon Sep 17 00:00:00 2001 From: ComputerTech Date: Mon, 6 Apr 2026 19:18:28 +0100 Subject: [PATCH] fix: call init_db() at module level so rate_limits table is created under gunicorn --- app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 93e6d33..6f73f21 100644 --- a/app.py +++ b/app.py @@ -550,8 +550,11 @@ def gone(error): # ── Entry point ─────────────────────────────────────────────────────────────── +# Always initialise the DB when the module is imported (works under Gunicorn +# and other WSGI servers that import app directly, not just via wsgi.py). +init_db() + if __name__ == '__main__': - init_db() app.run( debug=_server.get('debug', False), host=_server.get('host', '0.0.0.0'),