typeerror: __call__() takes 2 positional arguments but 3 were given (Gunicorn)

typeerror: __call__() takes 2 positional arguments but 3 were given (Gunicorn)

我使用 Flask 制作了一个网络应用程序。当我在本地 运行 该应用程序工作正常(Gunicorn 根本没有受到影响)但是当我在 Heroku 上部署该应用程序时,它会在控制台中引发以下 TypeError。

2021-03-28T15:42:25.446327+00:00 app[web.1]: Traceback (most recent call last):
2021-03-28T15:42:25.446329+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 136, in handle
2021-03-28T15:42:25.446329+00:00 app[web.1]:     self.handle_request(listener, req, client, addr)
2021-03-28T15:42:25.446336+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
2021-03-28T15:42:25.446337+00:00 app[web.1]:     respiter = self.wsgi(environ, resp.start_response)
2021-03-28T15:42:25.446345+00:00 app[web.1]: TypeError: __call__() takes 2 positional arguments but 3 were given

我的procfile是这样的:

web: gunicorn app:app

Gunicorn 也安装正确。

我尝试过的东西:

2021-03-28T15:49:20.246747+00:00 app[web.1]: Traceback (most recent call last):
2021-03-28T15:49:20.246748+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 136, in handle
2021-03-28T15:49:20.246749+00:00 app[web.1]:     self.handle_request(listener, req, client, addr)
2021-03-28T15:49:20.246756+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.8/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
2021-03-28T15:49:20.246757+00:00 app[web.1]:     respiter = self.wsgi(environ, resp.start_response)
2021-03-28T15:49:20.246758+00:00 app[web.1]: TypeError: __call__() missing 1 required positional argument: 'send'

Flask 是一个 WSGI 框架,它与 WSGI 服务器 Gunicorn 配合得很好。然而,Quart 是一个 ASGI 框架,因此需要一个 ASGI 服务器。 Quart docs recommend ASGI 服务器 Hypercorn.