我已经按照本教程进行了两次,但是在我运行它的第二台机器上,我得到了一个主管运行的 gunicorn 错误。当我告诉主管使用以下方法启动 gunicorn 时:
$ sudo supervisorctl start gunicorn
gunicorn: ERROR (abnormal termination)
gunicorn_err.log 重复这个:
Unknown command: 'run_gunicorn'
Type 'manage.py help' for usage.
主管配置如下所示:
[program:gunicorn]
command=/home/ubuntu/.virtualenvs/<VIRTUALENV>/bin/python /home/ubuntu/<APPNAME>/manage.py run_gunicorn -w 4 -k gevent
directory=/home/ubuntu/<APPNAME>
user=www-data
autostart=true
autorestart=true
stdout_logfile = /var/log/supervisor/gunicorn.log
stderr_logfile = /var/log/supervisor/gunicorn_err.log
gunicorn.log 是空的。我尝试将用户更改为 ubuntu 并在没有 virtualenv 的情况下运行(我的“默认”python 环境也已准备就绪,因为它具有所有先决条件包。)我什至尝试在 gunicorn 中删除变量分配之间的空格。 conf 实际上,如果我手动运行:
$ /usr/bin/python /home/ubuntu/<APPNAME>/manage.py run_gunicorn -w 4 -k gevent
2013-01-22 19:20:33 [1231] [INFO] Starting gunicorn 0.17.2
2013-01-22 19:20:33 [1231] [INFO] Listening at: http://127.0.0.1:8000 (1231)
2013-01-22 19:20:33 [1231] [INFO] Using worker: gevent
2013-01-22 19:20:33 [1236] [INFO] Booting worker with pid: 1236
2013-01-22 19:20:33 [1237] [INFO] Booting worker with pid: 1237
2013-01-22 19:20:33 [1238] [INFO] Booting worker with pid: 1238
2013-01-22 19:20:33 [1239] [INFO] Booting worker with pid: 1239
与 virtualenv python 运行相同:
$ /home/ubuntu/.virtualenvs/<VIRTUALENV>/bin/python /home/ubuntu/<APPNAME>/manage.py run_gunicorn -w 4 -k gevent
2013-01-22 19:21:53 [1246] [INFO] Starting gunicorn 0.17.2
2013-01-22 19:21:53 [1246] [INFO] Listening at: http://127.0.0.1:8000 (1246)
2013-01-22 19:21:53 [1246] [INFO] Using worker: gevent
2013-01-22 19:21:53 [1251] [INFO] Booting worker with pid: 1251
2013-01-22 19:21:53 [1252] [INFO] Booting worker with pid: 1252
2013-01-22 19:21:53 [1253] [INFO] Booting worker with pid: 1253
2013-01-22 19:21:53 [1254] [INFO] Booting worker with pid: 1254
当我可以使用任何 python 环境运行它并且它可以工作时,主管启动的 gunicorn 怎么可能找不到“run_gunicorn”命令?是'gunicorn'
的,在INSTALLED_APPS