Python tutorials Django tutorials Hardware reviews Mini-computers and electronics Linux and programming Astronomy and Astrophotography 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 gsm 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. gsm It can manage chaussette, celery or other sockets and processes making it a manager gsm of all project services. Chaussette
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
[circus] endpoint = tcp://127.0.0.1:5555 gsm pubsub_endpoint = tcp://127.0.0.1:5556 stats_endpoint = tcp://127.0.0.1:5557 [watcher:web] cmd = /path/to/application_virtualenv/bin/chaussette --fd $(circus.sockets.web) my_application.wsgi:application use_sockets = True numprocesses = 2 [socket:web] host = 0.0.0.0 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.
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; proxy_pass http://127.0.0.1:8000; gsm } }
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. Addons
More gsm astrophotos
No comments:
Post a Comment