2017-06-16 92 views
1

我有一個數字海洋水滴在ubuntu上通過gunicorn運行django項目。 conda環境來管理python依賴項。在新貴的配置文件中激活conda環境

我可以登錄,運行source activate py35,cd到django項目中,並運行gunicorn django.wsgi -w 2 -t 360,並讓所有內容都可以毫無問題地啓動。

我試圖修改被數字海洋創建當液滴被創造了新貴腳本:

description "Gunicorn daemon for Django project" 

start on (local-filesystems and net-device-up IFACE=eth0) 
stop on runlevel [!12345] 

# If the process quits unexpectadly trigger a respawn 
respawn limit 10 2 

setuid my_username 
setgid my_username 
chdir /home/my_username/django 


script 
    exec source activate py35 
    exec gunicorn django.wsgi -w 2 -t 360 
end script 

然而,工人無法啓動,並在日誌中的錯誤是由於項目試圖在python的標準安裝上運行,而不是conda env。如何在新貴的配置文件中激活conda環境?

回答

0

新貴用途/ bin/sh的,而源需要與/斌/慶典執行

試試這個:

script 
/bin/bash <<EOT 
    source activate py35 && gunicorn django.wsgi -w 2 -t 360 
EOT 
end script