Activating Gunicorn through virtualenv with Supervisor for Flask Application Activating Gunicorn through virtualenv with Supervisor for Flask Application nginx nginx

Activating Gunicorn through virtualenv with Supervisor for Flask Application


You were on the right track, but it's simpler than you were making it. To run a Flask app named run with entry point app via gunicorn under supervisor with the path you gave:

/etc/supervisor/conf.d/run.conf

[program:run]command = /var/www/sitename/env/bin/gunicorn run:app -b localhost:8000directory = /var/www/sitenameuser = siteuser

You can provide the environment argument to set stuff like production mode or whatever, but this is all you need to have the virtual environment version of gunicorn, running python 3 if it's a python 3 venv, run your flask app in the same virtual environment.