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", + ])