There are popular servers written in Python that contain WSGI applications and serve HTTP. These servers stand alone when they run; you can proxy to them from your web server.


Gunicorn is a WSGI and HTTP server for UNIX. Below is an example of configuration file with recommended settings.
from multiprocessing import cpu_count

# The sockets to bind:
bind: list[str] = [""]

# The maximum number of pending connections:
backlog: int = 65535

# Load application code before the worker processes are forked:
preload_app: bool = True

# The number of worker processes for handling requests:
workers: int = cpu_count()

# The number of worker threads for handling requests:
threads: int = workers * 2

By default, a file named will be read from the same directory where Gunicorn is being run.

$ gunicorn your_project:app

Gunicorn provides many options for configuring the server, either through a configuration file or with command line options. Use gunicorn --help or see the documentation for more information.


uWSGI is a fast application server written in C. Below is an example of configuration file with recommended settings.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

  <threads>%(processes * 2)</threads>


  <limit-post>52428800</limit-post>  <!-- 50 megabytes -->


To run uWSGI, you must specify the path to the configuration file.

$ uwsgi --xml uwsgi.xml

Keep in mind that uWSGI is an enormous project with hundreds of features and configurations. If you want to use all the features, check out the full documentation.

If you want to deploy your application to another WSGI server, look up the documentation about how to use a WSGI application with it.