Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python __调用()缺少1个必需的位置参数:';发送';应用程序引擎上的FastAPI_Python_Google App Engine_Google Cloud Platform_Gunicorn_Fastapi - Fatal编程技术网

Python __调用()缺少1个必需的位置参数:';发送';应用程序引擎上的FastAPI

Python __调用()缺少1个必需的位置参数:';发送';应用程序引擎上的FastAPI,python,google-app-engine,google-cloud-platform,gunicorn,fastapi,Python,Google App Engine,Google Cloud Platform,Gunicorn,Fastapi,当尝试在AppEngine上托管API时,以下错误不断出现。该程序过去在烧瓶上运行,但运行速度很慢 错误: Docker文件: app.yaml App Engine需要您的main.py文件来声明与 由于FastAPI是一个异步web框架,它与WSGI(同步)不兼容 您最好的选择是使用类似的服务,它允许您定义自己的运行时并使用与FastAPI兼容的异步HTTP服务器。正如Dustin所说,我发现需要更改worker类。试试下面这个 gunicorn -k uvicorn.workers.Uvi

当尝试在AppEngine上托管API时,以下错误不断出现。该程序过去在烧瓶上运行,但运行速度很慢

错误: Docker文件: app.yaml
App Engine需要您的
main.py
文件来声明与

由于FastAPI是一个异步web框架,它与WSGI(同步)不兼容


您最好的选择是使用类似的服务,它允许您定义自己的运行时并使用与FastAPI兼容的异步HTTP服务器。

正如Dustin所说,我发现需要更改worker类。试试下面这个

gunicorn -k uvicorn.workers.UvicornWorker main:app

上发现此错误基本上表明您试图以WSGI的形式运行FastAPI,这是不正确且不可接受的,因为FastAPI仅与ASGI兼容。请参阅Thank@YagizcanDegirmenci我将尝试仅使用UVICorn运行它,但现在我收到此错误,
“[error]33#33:*92500 connect()失败(111:连接被拒绝)在连接到上游时,客户端:216.58.212.244,服务器:
我正在尝试查找有关如何将Cloud Run配置为使用异步HTTP服务器的任何信息。有人能告诉我相应的文档吗?谢谢。@BellaveJayaram因为Cloud Run允许您使用任何容器映像,所以使用异步HTT不需要任何特定信息如果您想使用某个特定的服务器,并且不确定如何开始,我建议您提出一个新问题,而不是在这里留下评论。
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
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
gunicorn -k uvicorn.workers.UvicornWorker main:app