2012-04-20 126 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