Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Quart Python app in Google App Engine

I'm trying to deploy a Quart based python app via Google Cloud's App Engine Standard. However, I keep getting the following error:

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'

I know that Quart is an ASGI solution and Google App Engine is a Serverless setting. One of the recommendations for deploying quart into AWS Lambda was to use Magnum. Does that work for Google Cloud App Engine as well?

Any help would be appreciated.

like image 932
Harold Avatar asked Sep 14 '25 00:09

Harold


2 Answers

From 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.

This also means that Quart will not be compatible with App Engine, Cloud Functions, etc.

However, it would work well with Cloud Run via a HTTP server that supports ASGI such as Uvicorn.

like image 102
Dustin Ingram Avatar answered Sep 15 '25 13:09

Dustin Ingram


Magnum is an adapter for using ASGI applications with AWS Lambda & API Gateway and is not tested for Google GCP.

I recommend following the suggestion of @di and use Uvicorn with Cloud Run.

like image 28
Juancki Avatar answered Sep 15 '25 13:09

Juancki