Command line interface (CLI)

If you don’t need to add websockets or async request handlers to your app, but still want to run your WSGI app on the asyncio event loop, aiohttp_wsgi provides a simple command line interface.

Example usage

Serve a WSGI application called application, located in the your_project.wsgi module:

aiohttp-wsgi-serve your_project.wsgi:application

Serve a WSGI application and include a static file directory.

aiohttp-wsgi-serve your_project.wsgi:application --static /static=./static

Command reference

You can view this reference at any time with aiohttp-wsgi-serve --help.

usage: aiohttp-wsgi-serve [-h] [--host HOST] [--port PORT]
                          [--unix-socket UNIX_SOCKET]
                          [--unix-socket-perms UNIX_SOCKET_PERMS]
                          [--backlog BACKLOG] [--static STATIC]
                          [--script-name SCRIPT_NAME]
                          [--url-scheme URL_SCHEME] [--threads THREADS]
                          [--inbuf-overflow INBUF_OVERFLOW]
                          [--max-request-body-size MAX_REQUEST_BODY_SIZE]
                          [--shutdown-timeout SHUTDOWN_TIMEOUT] [--verbose]
                          [--quiet] [--version]
                          module:application

Run a WSGI application.

positional arguments:
  module:application    A WSGI application callable.

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           Host interfaces to bind. Defaults to '0.0.0.0' and
                        '::'. Can be specified multiple times.
  --port PORT, -p PORT  Port to bind. Defaults to 8080.
  --unix-socket UNIX_SOCKET
                        Path to a unix socket to bind, cannot be used with
                        host.
  --unix-socket-perms UNIX_SOCKET_PERMS
                        Filesystem permissions to apply to the unix socket.
                        Defaults to 384.
  --backlog BACKLOG     Socket connection backlog. Defaults to 1024.
  --static STATIC       Static route mappings in the form 'path=directory'.
                        `path` must start with a slash, but not end with a
                        slash. Can be specified multiple times.
  --script-name SCRIPT_NAME
                        URL prefix for the WSGI application, should start with
                        a slash, but not end with a slash. Defaults to ''.
  --url-scheme URL_SCHEME
                        A hint about the URL scheme used to access the
                        application. Corresponds to
                        environ['wsgi.url_scheme']. Default is auto-detected
                        to 'http' or 'https'.
  --threads THREADS     Number of threads used to process application logic.
                        Defaults to 4.
  --inbuf-overflow INBUF_OVERFLOW
                        A tempfile will be created if the request body is
                        larger than this value, which is measured in bytes.
                        Defaults to 524288.
  --max-request-body-size MAX_REQUEST_BODY_SIZE
                        Maximum number of bytes in request body. Defaults to
                        1073741824. Larger requests will receive a HTTP 413
                        (Request Entity Too Large) response.
  --shutdown-timeout SHUTDOWN_TIMEOUT
                        Timeout when closing client connections on server
                        shutdown. Defaults to 60.0.
  --verbose, -v         Increase verbosity. Can be specified multiple times.
  --quiet, -q           Decrease verbosity. Can be specified multiple times.
  --version             Display version information.