[英]TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
[英]typeerror: __call__() takes 2 positional arguments but 3 were given (Gunicorn)
我使用 flask 制作了 web 應用程序。 該應用程序在我本地運行時運行良好(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 也安裝正確。
我嘗試過的事情:
也嘗試設置 procfile: web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app
(沒用)
編輯:我將 python 運行時更新為python-3.8.6
並導致不同的錯誤:
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文檔推薦ASGI 服務器 Hypercorn。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.