在 Google App Engine 中部署 Quart Python 应用程序

Deploying a Quart Python app in Google App Engine

我正在尝试通过 Google Cloud 的 App Engine 标准部署基于 Quart 的 python 应用程序。但是,我不断收到以下错误:

Traceback (most recent call last):
  File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 284, in handle
    keepalive = self.handle_request(req, conn)
  File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 333, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: __call__() missing 1 required positional argument: 'send'

我知道 Quart 是一个 ASGI 解决方案,GoogleApp Engine 是一个无服务器设置。将 quart 部署到 AWS Lambda 的建议之一是使用 Magnum。这也适用于 Google Cloud App Engine 吗?

如有任何帮助,我们将不胜感激。

来自https://github.com/pgjones/quart/issues/68

Quart is an ASGI framework, rather than a WSGI framework, which means that it cannot work with serverless. It can work with Mangum, which is an ASGI alternative to serverless.

这也意味着 Quart 将与 App Engine、Cloud Functions 等不兼容

但是,它会与 Cloud Run via a HTTP server that supports ASGI such as Uvicorn 配合使用。

Magnum 是将 ASGI 应用程序与 AWS Lambda 和 API 网关结合使用的适配器,未针对 Google GCP 进行测试。

我建议听从@di 的建议,使用 Uvicorn with Cloud 运行。