2012-04-20 121 views
2

我用django運行芹菜和偉大的發展。但現在我想讓它在我的生產服務器上生存 ,我遇到了一些問題。芹菜和Django,記錄芹菜

我的設置如下:

  • Ubuntu的
  • Nginx的
  • Vitualenv
  • 新貴
  • Gunicorn
  • Django的

我不知道如何現在聖藝術芹菜與django時,它開始與暴發戶,它在哪裏登錄?

即時通訊開始Django的位置:

~$ cd /var/www/webapps/minamobime_app 
~$ source ../bin/activate 

EXEC在/ var/WWW/webapps /下斌/ gunicorn_django -w $ NUM_WORKERS \ --user = $ USER --group = $ GROUP --bind = $ IP:$ PORT --log級=調試\ --log文件= $ LOGFILE 2 >> $ LOGFILE

我該如何開始芹菜?

exec python manage.py celeryd -E -l info -c 2 

回答

3

考慮將芹菜配置爲daemon。對於記錄speciy:

CELERYD_LOG_FILE = 「/無功/日誌/芹菜/%n.log」

其中%s將由節點名替換

+0

我應該怎樣下手新貴芹菜只爲這方面的問題,這將正常工作。目前我有這樣的:exec/var/www/webapps/bin/gunicorn_django -w $ NUM_WORKERS \ --user = $ USER --group = $ GROUP --bind = $ IP:$ PORT --log-level = debug \ --log-file = $ LOGFILE 2 >> $ LOGFILE exec python manage。py celeryd -E -l info -c 2 – Harry 2012-04-20 10:51:38

2

您可以安裝主管使用apt-get,然後您可以將以下內容添加到名爲celeryd.conf(或您希望的任何名稱)的文件到etc/supervisor/conf.d文件夾(如果不存在,請創建conf.d文件夾)

; ================================== 
; celery worker supervisor example 
; ================================== 

[program:celery] 
; Set full path to celery program if using virtualenv 
command=/home/<path to env>/env/bin/celery -A <appname> worker -l info 
;enter the directory in which you want to run the app 
directory=/home/<path to the app> 
user=nobody 
numprocs=1 
stdout_logfile=/home/<path to the log file>/worker.log 
stderr_logfile=/home/<path to the log file>/worker.log 
autostart=true 
autorestart=true 
startsecs=10 

; Need to wait for currently executing tasks to finish at shutdown. 
; Increase this if you have very long running tasks. 
stopwaitsecs = 1000 

; When resorting to send SIGKILL to the program to terminate it 
; send SIGKILL to its whole process group instead, 
; taking care of its children as well. 
killasgroup=true 

; if rabbitmq is supervised, set its priority higher 
; so it starts first 
priority=998 

以下行同時添加到等/上司/ supervisord.conf

[include] 
files = /etc/supervisor/conf.d/*.conf 

現在,通過在終端和芹菜打字supervisord將根據你上面所做的設置自動啓動啓動主管。

+0

您還可以將django和其他程序添加到supervisord以自動啓動它們。您可以訪問http://supervisord.org/瞭解更多信息。 – manky1304 2014-12-09 17:42:18

1

您可以運行:

python manage.py celery worker 

,如果你有djceleryINSTALLED_APPS