Django, uWSGI and Supervisord config

8,570

I found this was pretty confusing until I discovered emperor mode.

This means you can do one supervisord instance to manage all of your configs:

[program:uwsgi]
command=/usr/local/bin/uwsgi --emperor /etc/uwsgi/apps-enabled
stopsignal=QUIT
autostart=true
autorestart=true
redirect_stderr=true

And then you'd pop any config files (ini, xml, yaml) for apps into the /etc/uwsgi/apps-enabled directory.

Not sure if this works with 0.9, but defintely works with 1.0.

Here's an example ini for a Flask app:

[uwsgi]
socket = /tmp/uwsgi_%n.sock
module = wire:app
chdir = /srv/%n/wire
env = WIRE_SETTINGS=/srv/%n/wire/config.py
virtualenv = /srv/%n
uid = wire
gid = www-data
single-interpreter = false
chmod = 770
processes = 3
Share:
8,570

Related videos on Youtube

Veles
Author by

Veles

Updated on September 17, 2022

Comments

  • Veles
    Veles over 1 year

    OK I have Django, nginx and uWSGI set up on my server...the problem is I start uWSGI manually via this command:

    uwsgi -s /home/user/sites/sock/uwsgi.sock -t 10 -M -p 1 -C --pythonpath /home/user/sites/ -w mysite.django_wsgi

    And it's working great. The thing I would like to do is use supervisord to control the uWSGI processes (start, stop, etc.). How would I do this, what would the supervisord config look like?