Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ASGI server documentation #1791

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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