我正试图从主管那里运行一系列
Python应用程序.它在Mac OSX上工作正常,但是当我尝试在Ubuntu上运行相同的应用程序时,主管似乎没有激活virtualenv,因此我的脚本会抛出错误.
这是我的结构:
/home/user/Sites/my-site - app.py - venv - supervisor.conf
我的supervisor.conf文件如下所示:
[program:python-app] autorestart = false autostart = false startsecs = 0 command = python app.py startretries = 1 environment=PYTHONPATH="%(here)s" [unix_http_server] file = /tmp/supervisor.sock [supervisord] logfile = logs/supervisord.log pidfile = logs/supervisord.pid environment=PYTHONPATH="%(here)s" [supervisorctl] serverurl = unix:///tmp/supervisor.sock [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [unix_http_server] username = supervisor_admin password = [inet_http_server] username = supervisor_admin password = port = *:9001
如何让主管在虚拟环境中运行python应用程序?
您提供的命令应使用虚拟环境中的python二进制文件:
command = /home/user/Sites/my-site/venv/bin/python /home/user/Sites/my-site/app.py