天天看點

如何将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