芹菜和Django,logging芹菜

我正在用django运行芹菜,并且在开发中工作很棒。 但是现在我想让它在我的生产服务器上运行,并且遇到了一些问题。

我的设置如下:

  • Ubuntu的
  • Nginx的
  • Vitualenv
  • 暴发户
  • Gunicorn
  • Django的

我不知道如何现在启动与django的芹菜,当它开始与新贵,它在哪里login?

我在这里开始Django:

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

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 

考虑将芹菜配置为守护进程 。 对于记录规格:

CELERYD_LOG_FILE = “/无功/日志/芹菜/%n.log”

其中%s将被节点名称替换

您可以使用apt-get安装supervisor ,然后将以下内容添加到名为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 

还要将以下几行添加到etc / supervisor / supervisord.conf

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

现在通过在终端输入supervisord启动主管,芹菜将根据您上面所做的设置自动启动。

你可以运行:

 python manage.py celery worker 

如果你在你的INSTALLED_APPSdjcelery ,这将工作