Skip to main content
The Python ecosystem offers a number of web servers that can be used to deploy to Upsun. The following examples deploy a Django project named myapp. They assume a myapp/wsgi.py or myapp/asgi.py file with a callable application. Adjust the examples to fit your framework and app.

Gunicorn

Gunicorn is a Python WSGI HTTP Server for Unix that operates on a pre-fork worker model. The Gunicorn server is broadly compatible with various web frameworks, light on server resource usage, and fast. To deploy with Gunicorn on Upsun, use one of the following examples to update your app configuration. The examples vary based on both your package manager (Pip, Pipenv, or Poetry) and whether your app listens on a TCP (default) or Unix (for running behind a proxy server) socket. For more information on upstream sockets and protocols, see the application reference. The snippets below assume that Gunicorn has been added as a dependency to your requirements.txt, Pipfile.lock, or poetry.lock.

Gunicorn workers

These examples define four worker processes with -w 4. For more details on what you can configure, see the Gunicorn documentation. Workers can also be defined with a custom worker class, such as Uvicorn, gevent, or Tornado. For example, to add a Uvicorn worker class to the pip example for Unix, adjust the start command to the following:

Daphne

Daphne is a HTTP, HTTP2 ,and WebSocket protocol server for ASGI and ASGI-HTTP, developed to power Django Channels. To deploy with Daphne on Upsun, use one of the following examples to update your app configuration. The examples vary based on both your package manager (Pip, Pipenv, or Poetry) and whether your app listens on a TCP (default) or Unix (for running behind a proxy server) socket. For more information on upstream sockets and protocols, see the application reference. The snippets below assume that Daphne has been added as a dependency to your requirements.txt, Pipfile.lock, or poetry.lock.

Uvicorn

Uvicorn is an ASGI web server implementation for Python. To deploy with Uvicorn on Upsun, use one of the following examples to update your app configuration. The examples vary based on both your package manager (Pip, Pipenv, or Poetry) and whether your app listens on a TCP (default) or Unix (for running behind a proxy server) socket. For more information on upstream sockets and protocols, see the application reference. The snippets below assume that Uvicorn has been added as a dependency to your requirements.txt, Pipfile.lock, or poetry.lock.

Uvicorn workers

These examples define four worker processes with -w 4. For more recommendations on this and other settings, see the Uvicorn documentation. Instead of the -w flag, you can also use the WEB_CONCURRENCY variable. See how to set variables.

Hypercorn

Hypercorn is an ASGI and WSGI web server inspired by Gunicorn. To deploy with Hypercorn on Upsun, use one of the following examples to update your app configuration. The examples vary based on both your package manager (Pip, Pipenv, or Poetry) and whether your app listens on a TCP (default) or Unix (for running behind a proxy server) socket. For more information on upstream sockets and protocols, see the application reference. The snippets below assume that Hypercorn has been added as a dependency to your requirements.txt, Pipfile.lock, or poetry.lock.

Hypercorn workers

These examples define four worker processes with -w 4. For more details on what you can configure, see the Hypercorn documentation. Workers can also be defined with a custom worker class, such as Asyncio, Uvloop, or Trio. For example, to add a Asyncio worker class to the pip example for Unix, adjust the start command to the following:
Last modified on March 11, 2026