Chaussette and Circus as a new way to deploy your Django applications

Many Python web applications run on production with the help of gunicorn or uwsgi. There are however other solutions that may turn out to be even better than the currently popular solutions. One of alternatives is chaussette and circus. Chaussette is a WSGI server that can serve WSGI applications like your Django project. Circus is an application to control and monitor processes and sockets. It can manage chaussette, celery or other sockets and processes making it a manager of all project services.


You can install chaussette with pip and run your Django application with:

chaussette my_application.wsgi.application

In case of Django the file is used. If you have custom settings files be sure to set the correct one in that file or chaussette may have problems starting your application.

Chaussette on its own won't give much. It need a supervisor or circus to manage it.


Circus is a process/socket manager and monitor. It's similar to supervisor but has bit different approach. We can install it via pip and after that we can start configuring it and services it should manage.

Circus differs from supervisor as it can work as a hub of all of project services. Local circus may manage all local services and servers of the project and be managed by system global supervisor. In a supervisor + gunicorn configuration the gunicorn was making a breach as it and other services where managed by the global supervisor. If you host many applications on one server circus + chaussette may help a lot.

Quick example - Django configuration

Now we can put the chaussette startup code into circus.ini so that circus can manage it. Let us start with such circus.ini:

endpoint = tcp://
pubsub_endpoint = tcp://
stats_endpoint = tcp://

cmd = /path/to/application_virtualenv/bin/chaussette --fd $(circus.sockets.web) my_application.wsgi:application
use_sockets = True
numprocesses = 2

host =
port = 8000

The start of the file is circus configuration take from one of the examples, next we have chaussette configuration in the "web" blocks (web is the application name within circus, it may be different). Parameters available for every block are in the documentation.

When we have a finished configuration file we can start circus with:

circusd circus.conf

If it works then we can use is it with nginx using such configuration:

server {
  listen  80;

  location /static/ {
      alias /path/to/static/;
  location /media/ {
      alias /path/to/media/;

  location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;

Where most important part is the location /. proxy_pass must be set to the IP/port on which chaussette is listening (configured in socket:web) - in this case we have 8000. Alternative way would be to configure chaussette to use sockets which then would have to be passed to proxy_pass.


circusctl is an interactive shell for circus. You can check or restart services managed by circus. After deploying a new version of your app you can even reload and restart everything:

circusctl reloadconfig --waiting
circusctl reload --waiting

For monitoring load you can use circus-top, or circus-web.

I hope this quick article will make you interested in chaussette and circus combination for your production configuration.


Django web framework tutorials, 25 August 2014, Piotr MaliƄski

Comment article
RkBlog main page Search RSS Contact