Depending on your setup and preferences, there are multiple ways to run Emmett applications. In this chapter, we'll try to document the most common ones.

If you want to use an ASGI server not listed in this section, please refer to its documentation, remembering that your Emmett application object is the actual ASGI application (following spec version 3.0).

Included server

Emmett comes with an included server based on uvicorn. In order to run your application in production you can just use the included serve command:

emmett serve --host --port 80

You can inspect all the available options of the serve command using the --help option.


The included server might suit most of the common demands, but whenever you need a fully featured server, you can use Gunicorn.

Emmett includes a Gunicorn worker class allowing you to run ASGI applications with the Emmett's environment, while also giving you Gunicorn's fully-featured process management:

gunicorn myapp:app -w 4 -k emmett.asgi.workers.EmmettWorker

This allows you to increase or decrease the number of worker processes on the fly, restart worker processes gracefully, or perform server upgrades without downtime.


Even if Docker is not properly a deployment option, we think giving an example of a Dockerfile for an Emmett application is proficient for deployment solutions using container orchestrators, such as Kubernetes or Mesos.

In order to keep the image lighter, we suggest to use the alpine Python image as a source:

FROM python:3.8-alpine

RUN apk add --no-cache libstdc++

RUN mkdir -p /usr/src/deps
WORKDIR /usr/src/deps
COPY requirements.txt /usr/src/deps
RUN apk add --no-cache --virtual build-deps \
    g++ \
    libffi-dev \
    libuv-dev \
    make \
    musl-dev \
    openssl-dev && \
    pip install --no-cache-dir -r /usr/src/deps/requirements.txt && \
    apk del build-deps

COPY ./ /app


CMD [ "emmett", "serve" ]