python - __call__() 缺少 1 个必需的位置参数:App Engine 上的“发送”FastAPI
问题描述
尝试在 App Engine 上托管 API 时,不断出现以下错误。该程序曾经在 Flask 上运行,该程序可以运行但速度很慢。
错误:
"Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle
self.handle_request(listener, req, client, addr)
File "/env/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
respiter = self.wsgi(environ, resp.start_response)
TypeError: __call__() missing 1 required positional argument: 'send'
"
码头工人文件:
FROM gcr.io/google_appengine/python
RUN apt-get update && apt-get install -y ffmpeg
# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
RUN virtualenv /env -p python3.7
# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
# Add the application source code.
ADD . /app
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
应用程序.yaml
runtime: custom
env: flex
entrypoint: gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
service: encoder
runtime_config:
python_version: 3
handlers:
- url: /.*
script: auto
解决方案
推荐阅读
- java - 如何从java中的输入标签中获取值?
- javascript - 如何计算点击次数
- plotly - 可编辑形状的回调函数(Plotly-Dash)
- twitter-bootstrap - Bootstrap 3:增加徽章的大小
- java - 为什么我的 Java GUI Swing 应用程序显然被锁定为 60 fps?
- vue.js - 使用对话框中的删除按钮删除 Vuetify 数据表中的行
- pact - 当正文为列表时,Spring Cloud Contract 生成正文为空的 Pact
- excel - Find the last semester using Function LastQuarter + 2
- omnet++ - Omnetpp-5.6.1 WIndows installation issues
- powershell - 如何在 PowerShell 中使用 ForEach 计算数组中小于 10 的数字?