Controlling a virtualenv django application through a supervisor

I am trying to use a supervisor to manage my django project running gunicorn inside virtualenv. My conf file looks like this:

[program:diasporamas] command=/var/www/django/bin/gunicorn_django directory=/var/www/django/django_test process_name=%(program_name)s user=www-data autostart=false stdout_logfile=/var/log/gunicorn_diasporamas.log stdout_logfile_maxbytes=1MB stdout_logfile_backups=2 stderr_logfile=/var/log/gunicorn_diasporamas_errors.log stderr_logfile_maxbytes=1MB stderr_logfile_backups=2enter code here 

The problem is that I need a supervisor to run the command after running the "source bin / activate" in my virtualenv. I hung around Google trying to find the answer, but found nothing.

Note. I do not want to use virtualenvwrapper

Any help please?

+44
django pip virtualenv supervisord
Jun 30 2018-11-11T00:
source share
1 answer

the documentation for activating the virtualenv script says that it only changes the PATH environment variable, in which case you can do:

 [program:diasporamas] command=/var/www/django/bin/gunicorn_django directory=/var/www/django/django_test environment=PATH="/var/www/django/bin" ... 

Starting with version 3.2, you can use the variable extension to save the existing PATH:

 [program:diasporamas] command=/var/www/django/bin/gunicorn_django directory=/var/www/django/django_test environment=PATH="/var/www/django/bin:%(ENV_PATH)s" 

...

+82
Jun 30 2018-11-11T00:
source share



All Articles