我已在测试环境中的django设置中设置CELERY_ALWAYS_EAGER = True
。
但不知怎的,我仍然收到了这条消息。
ERROR:cacheback:Unable to trigger task asynchronously - failing over to synchronous refresh
ERROR:cacheback:[Errno 111] Connection refused
实际上CELERY_ALWAYS_EAGER = True
有效,这是我从django shell获得的。
$ python manage.py shell
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> from celery import Celery
>>> app = Celery()
>>> app.config_from_object('django.conf:settings')
>>> print app.conf.CELERY_ALWAYS_EAGER
True
>>> @app.task()
... def foo():
... print('FOO')
...
>>> print foo.delay()
FOO
4ff95b5c-f8bc-412b-ad19-602082aec1e9
>>>
有什么想法我仍然收到错误消息?非常感谢你!