python fastapi启动异常

Traceback (most recent call last):
  File "/www/server/pyporject_evn/938a03492a8c9623d65b698ac5ce249d_venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 271, in handle
    keepalive = self.handle_request(req, conn)
  File "/www/server/pyporject_evn/938a03492a8c9623d65b698ac5ce249d_venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: FastAPI.__call__() missing 1 required positional argument: 'send'
[2023-05-18 14:06:22 +0800] [4443] [ERROR] Error handling request /favicon.ico
Traceback (most recent call last):
  File "/www/server/pyporject_evn/938a03492a8c9623d65b698ac5ce249d_venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 271, in handle
    keepalive = self.handle_request(req, conn)
  File "/www/server/pyporject_evn/938a03492a8c9623d65b698ac5ce249d_venv/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: FastAPI.__call__() missing 1 required positional argument: 'send'
[2023-05-18 14:06:48 +0800] [4436] [INFO] Handling signal: term
[2023-05-18 14:06:48 +0800] [4443] [INFO] Worker exiting (pid: 4443)
[2023-05-18 14:06:49 +0800] [4442] [INFO] Worker exiting (pid: 4442)
[2023-05-18 14:06:49 +0800] [4436] [INFO] Shutting down: Master

使用 gunicorn 启动报错,请检查是否指定了worker-class参数
如:

gunicorn main:app --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --daemon

你可能感兴趣的:(Python,异常,python,fastapi,开发语言)