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

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 1–7why, one step back
1.. _asgi:
23ASGI4====56If you'd like to use an ASGI server you will need to utilise WSGI to7ASGI middleware. The asgiref

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

line 8why, one step back
8`WsgiToAsgi <https://github.com/django/asgiref#wsgi-to-asgi-adapter>`_

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 9–23why, one step back
9adapter is recommended as it integrates with the event loop used for
10Flask'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)23

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

line 24why, one step back
24and then serving the ``asgi_app`` with the ASGI server, e.g. using

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 25–29why, one step back
25`Hypercorn <https://gitlab.com/pgjones/hypercorn>`_,
2627.. sourcecode:: text2829 $ hypercorn module:asgi_app