我在使用 Gunicorn 和 Supervisor 部署 Django 应用程序时遇到问题。虽然我可以让 Gunicorn 为我的应用程序提供服务(通过设置适当的 PYTHONPATH 并运行适当的命令,即来自 supervisord 配置的命令),但我无法让主管运行它。它只是看不到我的应用程序。我不知道如何确定配置文件是否正常。
这是 supervisorctl 所说的:
# supervisorctl start myapp_live
myapp_live: ERROR (no such process)
Run Code Online (Sandbox Code Playgroud)
我在 Ubuntu 10.04 上使用以下配置运行它:
文件 /home/myapp/live/deploy/supervisord_live.ini:
[program:myapp_live]
command=/usr/local/bin/gunicorn_django --log-file /home/myapp/logs/gunicorn_live.log --log-level info --workers 2 -t 120 -b 127.0.0.1:10000 -p deploy/gunicorn_live.pid webapp/settings_live.py
directory=/home/myapp/live
environment=PYTHONPATH='/home/myapp/live/eco/lib'
user=myapp
autostart=true
autorestart=true
Run Code Online (Sandbox Code Playgroud)
在 /etc/supervisor/supervisord.conf 文件的末尾,有:
[include]
files = /etc/supervisor/conf.d/*.conf
Run Code Online (Sandbox Code Playgroud)
这是我的配置文件的符号链接:
# ls -la /etc/supervisor/conf.d
lrwxrwxrwx 1 root root 48 Dec 4 18:02 myapp-live.conf -> /home/myapp/live/deploy/supervisord_live.ini
Run Code Online (Sandbox Code Playgroud)
对我来说一切都很好,但 supervisorctl 只是一直说myapp_live: ERROR (no …