Skip to content

Commit

Permalink
Improve ASGI server documentation (#1791)
Browse files Browse the repository at this point in the history
Discussions in #1757 indicate that we should document this more clearly.
  • Loading branch information
RobbeSneyders authored Nov 6, 2023
1 parent a910709 commit 55bdfba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,21 @@ You can run your application using an ASGI server such as `uvicorn`. If you defi

.. code-block:: bash
# assuming your application is defined as ``app`` in ``run.py``
$ uvicorn run:app
Or with gunicorn:
Or with gunicorn (which is recommended in production).

.. code-block:: bash
# assuming your application is defined as ``app`` in ``run.py``
$ gunicorn -k uvicorn.workers.UvicornWorker run:app
See the `uvicorn documentation`_ for more details.
See the `uvicorn documentation`_ for more details or check this
`overview of available ASGI servers`_ for other options.

.. _overview of available ASGI servers: https://asgi.readthedocs.io/en/latest/implementations.html#servers.


If you installed connexion using :code:`connexion[uvicorn]`, you can run it using the
:code:`run` method. This is only recommended for development:
Expand Down
13 changes: 13 additions & 0 deletions docs/v3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ should work, connexion comes with ``uvicorn`` as an extra:
pip install connexion[uvicorn]
Check :ref:`quickstart:Running your application` for more details on how to run your application
using an ASGI server.

.. warning::

You can wrap Connexion with the `ASGIMiddleware`_ offered by `a2wsgi`_ to run it with a WSGI
server. You will however lose the benefits offered by ASGI, and performance might be
impacted. You should only use this as a temporary workaround until you can switch to an ASGI
server.

.. _ASGIMiddleware: https://github.com/abersheeran/a2wsgi#convert-asgi-app-to-wsgi-app
.. _a2wsgi: https://github.com/abersheeran/a2wsgi

Smaller breaking changes
------------------------

Expand Down

0 comments on commit 55bdfba

Please sign in to comment.