通过主管监督virtualenv django应用程序

Ole*_*ade 47 django pip virtualenv supervisord

我正在尝试使用主管来管理我的django项目,在virtualenv中运行gunicorn.我的conf文件如下所示:

[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
Run Code Online (Sandbox Code Playgroud)

问题是,我需要主管在我的virtualenv中运行'source bin/activate'之后启动命令.我一直在谷歌试图寻找答案,但没有找到任何答案.

注意:我不想使用virtualenvwrapper

有什么帮助吗?

Mic*_*ski 82

virtualenv激活脚本的文档说它只修改了PATH环境变量,在这种情况下你可以这样做:

[program:diasporamas]
command=/var/www/django/bin/gunicorn_django
directory=/var/www/django/django_test
environment=PATH="/var/www/django/bin"
...
Run Code Online (Sandbox Code Playgroud)

从版本3.2开始,您可以使用变量扩展来保留现有的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"
Run Code Online (Sandbox Code Playgroud)

...