2016-11-21 69 views
1

我想部署一個基本的申請Amazon EC2。我的應用程序git clone'd到我的AWSUbuntu實例中,並且正在運行Django 1.10無法啓動gunicorn.service:使用<code>Django</code>,<code>Gunicorn</code>和<code>Nginx</code>單位gunicorn.service沒有找到

我能夠使用Gunicorn用下面的命令來運行我的應用程序...

gunicorn --bind 0.0.0.0:8000 blackspruceherbals.wsgi:application

我遇到了麻煩,雖然當我嘗試創建一個文件新貴爲Gunicorn。文件路徑如下...

/etc/init/gunicorn.conf

和暴發戶的代碼看起來像這樣...

description "Gunicorn application server handling black spruce herbals" 
start on runlevel [2345] 
stop on runlevel [!2345] 
respawn 
setuid ubuntu 
setgid www-data 
chdir /home/ubuntu/websitename/ 
exec bsh_env/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/websitename/websitename.sock websitename.wsgi:application 

當我運行...

sudo service gunicorn start

我得到以下錯誤...

Failed to start gunicorn.service: Unit gunicorn.service not found.

是怎麼回事?我在互聯網上尋找答案,但一無所獲。你能看到我做錯的事嗎?提前致謝。

+0

你的Ubuntu版本是什麼? –

+0

16.04 @AntonisChristofides –

回答

8

由於Ubuntu 15.04 upstart已被替換爲systemd。您需要創建一個文件/etc/systemd/gunicorn.service,它具有與upstart文件不同的語法。 FAQ可以讓你開始,參考是man systemd.service

相關問題