Skip to content
Myr

asgi.rst

This file

Path

docs/deploying/asgi.rst

29 lines · 684 bytes

Last changed by

Merge remote-tracking branch 'origin/2.0.x'David Lordbefore adoptionafc13b9

History of this file

Take it

1.. _asgi:23ASGI4====56If you'd like to use an ASGI server you will need to utilise WSGI to7ASGI middleware. The asgiref8`WsgiToAsgi <https://github.com/django/asgiref#wsgi-to-asgi-adapter>`_9adapter is recommended as it integrates with the event loop used for10Flask's :ref:`async_await` support. You can use the adapter by11wrapping the Flask app,1213.. code-block:: python1415    from asgiref.wsgi import WsgiToAsgi16    from flask import Flask1718    app = Flask(__name__)1920    ...2122    asgi_app = WsgiToAsgi(app)2324and then serving the ``asgi_app`` with the ASGI server, e.g. using25`Hypercorn <https://gitlab.com/pgjones/hypercorn>`_,2627.. sourcecode:: text2829    $ hypercorn module:asgi_app