我成功设置了 Celery 3.1 + Django 1.6 + Djcelery,任务正在工作,一切都很好。在 Django 管理界面中,我看到带有选项的 Djcelery 菜单,但在"任务"选项卡上看不到任何任务,在"工作线程"选项卡上没有工人。
如何配置以让它们自动存储状态?
我 settings.py:
# Celery settings
#BROKER_URL = 'amqp://guest:guest@localhost//'
BROKER_URL = 'django://'
from kombu.serialization import registry
registry.enable('pickle')
#: Only add pickle to this list if your broker is secured
#: from unwanted access (see userguide/security.html)
CELERY_ACCEPT_CONTENT = ['json', 'pickle']
CELERY_TASK_RESULT_EXPIRES=3600
#CELERY_RESULT_BACKEND='amqp'
CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend'
# postgresql
#CELERY_RESULT_BACKEND = 'db+postgresql://postgres:111222@localhost/graphgrail'
#CELERY_RESULT_BACKEND='djcelery.backends.cache:CacheBackend',
CELERY_RESULT_SERIALIZER = 'json' #json pickle msgpack
CELERY_TASK_SERIALIZER = 'json'
CELERY_IMPORTS=["vk_wall.tasks"]
你需要celerycam
在 UWSGi 中.ini(如果使用它部署),则需要以下行:
attach-daemon = /path/to/your/virtualenv/bin/python /var/www/yoursite/manage.py celerycam