2016-09-26 66 views
1

**檢查過了堆棧溢出**Gunicorn + Django的+主管 - 主管無法啓動Gunicorn:ENOENT

我一直在使用gunicorn和nginx的部署Django的。 django項目位於虛擬環境中。一切都可以正常使用,當我運行 -

gunicorn mydjangoproject.wsgi -c gunicorn_config.py

我運行包含manage.py與虛擬環境中進行活動我的Django項目文件夾內的上述命令。

但是現在我想關閉服務器終端並希望gunicorn自動運行。爲此我正在使用主管。我已經使用apt-get安裝了主管,並在主管的conf.d中創建了gunicorn.conf文件。

但是當我運行supervisorctl開始gunicorn我得到一個致命的錯誤 -
gunicorn:ERROR(異常終止)

所以檢查日誌文件,並將其says-

主管:能不能Exec根/ ervirtualenvpy2 /斌/ gunicorn:ENOENT
子進程並沒有催生

對上司的gunicorn.conf我的配置文件看起來像這個 -

[program:gunicorn] 
command = root/ervirtualenvpy2/bin/gunicorn myproject.wsgi -c  root/path/to/the/gunicorn_conf.py/file 
directory = root/ervirtualenvpy2/path/to/myproject/ 
user=root 
autorestart=true 
+0

ENOENT表示文件未找到。檢查你的文件路徑和supervisord訪問權限。 –

+0

爲什麼你如此熱衷於使用管理員而不是已經包含在系統中的新貴或systemd? –

+0

嗯,我正在使用管理員,因爲將來我想將芹菜,rabbitmq和memcached添加到我的項目中,並且我對所有此服務器設置和部署都很陌生,所以我對新貴和systemd不太瞭解。我依靠的是我在開始研究這個設置時發現的信息,並且我第一次遇到了主管。 –

回答

1

由你說什麼,你的配置一切似乎是正確的,除了您指定相對路徑,而不是絕對路徑展望:

看到gunicorn docs

相反,它應該是:

[program:gunicorn] 
command = /root/ervirtualenvpy2/bin/gunicorn myproject.wsgi -c /root/path/to/the/gunicorn_conf.py/file 
directory = /root/ervirtualenvpy2/path/to/myproject 
user=root 
autorestart=true