Skip to content
Myr

asgi.rst

This file

Path

docs/deploying/asgi.rst

27 lines · 673 bytes

Last changed by

Merge branch '2.1.x'David Lordbefore adoption9139af1

History of this file

Take it

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 1–5why, one step back
1ASGI
2====34If you'd like to use an ASGI server you will need to utilise WSGI to5ASGI middleware. The asgiref

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

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

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 7–21why, one step back
7adapter is recommended as it integrates with the event loop used for
8Flask's :ref:`async_await` support. You can use the adapter by9wrapping the Flask app,1011.. code-block:: python1213 from asgiref.wsgi import WsgiToAsgi14 from flask import Flask1516 app = Flask(__name__)1718 ...1920 asgi_app = WsgiToAsgi(app)21

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

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

Merge pull request #3967 from pgjones/docsDavid Lordbefore adoption03db919

lines 23–27why, one step back
23`Hypercorn <https://gitlab.com/pgjones/hypercorn>`_,
2425.. sourcecode:: text2627 $ hypercorn module:asgi_app