Gunicorn: TypeError: __call __ () مفقود الوسيطة الموضعية المطلوبة: 'send'

تم إنشاؤها على ٨ نوفمبر ٢٠١٩  ·  4تعليقات  ·  مصدر: benoitc/gunicorn

جونيكورن + فاستابي

فاستابي:

from fastapi import FastAPI
app = FastAPI()
@app.post("/tet")
async def root():
    return {"message": "Hello World"}

غونيكورن:

""
gunicorn -k gevent - ربط "0.0.0.0:8080" - تصحيح أخطاء مستوى السجل الرئيسي: التطبيق

 ```
gunicorn -k tornado --bind "0.0.0.0:8080" --log-level debug main:app

خطأ:

email-validator not installed, email fields will be treated as str.
To install, run: pip install email-validator
[2019-11-08 16:05:42 +0800] [12796] [DEBUG] 1 workers
[2019-11-08 16:05:49 +0800] [12799] [DEBUG] GET /tet
[2019-11-08 16:05:49 +0800] [12799] [ERROR] Error handling request /tet
Traceback (most recent call last):
  File "/home/ap/nlp/Anaconda3/lib/python3.6/site-packages/gunicorn/workers/base_async.py", line 56, in handle
    self.handle_request(listener_name, req, client, addr)
  File "/home/ap/nlp/Anaconda3/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 160, in handle_request
    addr)
  File "/home/ap/nlp/Anaconda3/lib/python3.6/site-packages/gunicorn/workers/base_async.py", line 107, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: __call__() missing 1 required positional argument: 'send'

التعليق الأكثر فائدة

تضمين التغريدة
شكرًا ، هل هذا يعني أن فئة العمال من gunicorn يجب أن تكون "uvicorn.workers.UvicornWorker"؟
مثل

gunicorn -k uvicorn.workers.UvicornWorker --bind "0.0.0.0:8080" --log-level debug main:app

هل هناك اي طرق اخرى؟

ال 4 كومينتر

يعمل FastAPI فقط في خادم ASGI. لا يشحن gunicorn إلا مع تطبيقات معيار PEP 3333 WSGI. الاثنان غير متوافقين.

تضمين التغريدة
شكرًا ، هل هذا يعني أن فئة العمال من gunicorn يجب أن تكون "uvicorn.workers.UvicornWorker"؟
مثل

gunicorn -k uvicorn.workers.UvicornWorker --bind "0.0.0.0:8080" --log-level debug main:app

هل هناك اي طرق اخرى؟

على حد علمي ، هذا هو العامل الوحيد الذي يطبق ASGI بدلاً من WSGI.

حسنا شكرا كثيرا!

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات