输入:
>>> from registration import tasks
>>> tasks.mail.delay()
<AsyncResult: 36a2e61c-493b-472c-99f1-cb2391110aa9>
>>> r=tasks.mail.delay()
>>> r.ready()
输出:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/celery/result.py", line 174, in ready
return self.state in self.backend.READY_STATES
File "/usr/local/lib/python2.6/dist-packages/celery/result.py", line 277, in state
return self.backend.get_status(self.id)
File "/usr/local/lib/python2.6/dist-packages/celery/backends/base.py", line 487, in _is_disabled
raise NotImplementedError('No result backend configured. '
NotImplementedError: No result backend configured. Please see the documentation for more information.
我如何配置后端,以便我可以修复特定的延迟时间
答案 0 :(得分:3)
如果使用celeryconfig.py配置模块,可以通过CELERY_RESULT_BACKEND设置配置结果后端
CELERY_RESULT_BACKEND="amqp"
或通过Celery实例
celery = Celery('tasks', backend='amqp', broker='amqp://')
请查看docs了解详情。