Add uvloop
This commit is contained in:
parent
8a7134f727
commit
67dfbf2e7c
|
@ -14,4 +14,4 @@ RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|||
|
||||
EXPOSE 8002
|
||||
|
||||
CMD ["gunicorn", "app.main:app", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4", "--loop", "uvloop"]
|
||||
CMD ["gunicorn", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8002", "--workers", "4"]
|
||||
|
|
10
app/main.py
10
app/main.py
|
@ -7,6 +7,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|||
from app.api import routes
|
||||
from app.core.config import settings
|
||||
from app.core.cache import cache
|
||||
import uvicorn
|
||||
|
||||
# Настройка логирования
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
@ -46,3 +47,12 @@ async def global_exception_handler(request: Request, exc: Exception):
|
|||
status_code=500,
|
||||
content={"detail": "Внутренняя ошибка сервера."},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(
|
||||
"app.main:app",
|
||||
host="0.0.0.0",
|
||||
port=8082,
|
||||
loop="uvloop"
|
||||
)
|
|
@ -1,5 +1,6 @@
|
|||
fastapi
|
||||
uvicorn[standard]
|
||||
uvloop
|
||||
transformers
|
||||
gunicorn
|
||||
redis>=4.0
|
||||
|
|
Loading…
Reference in New Issue