ASGI

If you’d like to use an ASGI server you will need to utilise WSGI to ASGI middleware. The asgiref [WsgiToAsgi](https://github.com/django/asgiref#wsgi-to-asgi-adapter) adapter is recommended as it integrates with the event loop used for Flask’s Using async and await support. You can use the adapter by wrapping the Flask app,

  1. from asgiref.wsgi import WsgiToAsgi
  2. from flask import Flask
  3. app = Flask(__name__)
  4. ...
  5. asgi_app = WsgiToAsgi(app)

and then serving the asgi_app with the asgi server, e.g. using Hypercorn,

  1. $ hypercorn module:asgi_app