From 2731bc7f09483e246f983e5832ac387ba20e2e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sun, 12 Jul 2026 10:18:04 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B2=D0=B5=D1=80=D0=BD=D1=83=D0=BB=20g?= =?UTF-8?q?unicorn+gevent=20=E2=80=94=20=D0=B1=D0=B5=D0=B7=20=D0=BD=D0=B8?= =?UTF-8?q?=D1=85=20Flask=20dev=20server=20=D0=BD=D0=B5=20=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B6=D0=B8=D1=82=20=D0=B4=D0=BE=D0=BB=D0=B3=D0=B8=D0=B5?= =?UTF-8?q?=20LLM-=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 ++ site/app.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8ca3c32..574b557 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ flask +gunicorn +gevent python-docx pdfplumber httpx diff --git a/site/app.py b/site/app.py index cfbfec7..415dce4 100644 --- a/site/app.py +++ b/site/app.py @@ -52,9 +52,17 @@ def create_app(): app = create_app() # Штурвал запускает: cd site && python app.py -# Нужен app.run() чтобы процесс слушал порт +# Внутри — gunicorn с gevent для долгих LLM-запросов if __name__ == "__main__": - app.run(host="0.0.0.0", port=5000, threaded=True) + import subprocess, sys + subprocess.run([ + sys.executable, "-m", "gunicorn", "app:app", + "--bind", "0.0.0.0:5000", + "--worker-class", "gevent", + "--workers", "1", + "--worker-connections", "1000", + "--timeout", "300", + ])