天天看点

如何将CELERY放到后台执行?How to keep Celery running with supervisor

在作正式环境,这个是必须的。

于是找了两小时文档,

以下这个方法,相对来说好实现。

就是要注意supervisord.conf的目录存放位置。

放在DJANGO的PROJ目录下,是最佳位置。

https://thomassileo.name/blog/2012/08/20/how-to-keep-celery-running-with-supervisor/

如何你不幸的和我一样,无法PIP只能用setup.py的话,可能celery和supervisord都要用绝对目录

  

~~~~~~~~~~~~~~~~

I'm using virtualenv, Celery 3.0.5, and supervisor 3.0. I'm assuming Celery is already installed and configured.

First, you need to install supervisor in your virtualenv and generate a configuration file.

I store a <code>supervisord.conf</code> config file at the root of each project, and also, be careful to use theabsolute path to the Python interpreter of the virtualenv.

Next, just add this section after the <code>[supervisord]</code> section:

Just run <code>supervisord</code> in your project directory.

Then, you can use the <code>supervisorctl</code> command to enter the interactive shell. Type <code>help</code> to get started. You can also execute supervisor command directly:

If you have any tips or suggestions, don't hesitate !

~~~~~~~~~~~~~~~

如何将CELERY放到后台执行?How to keep Celery running with supervisor