django-celery: No result backend configured

airfang picture airfang · Dec 8, 2011 · Viewed 16.4k times · Source

I am trying to use django-celery in my project

In settings.py I have

CELERY_RESULT_BACKEND = "amqp"

The server started fine with

python manage.py celeryd --setting=settings

But if I want to access a result from a delayed task, I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\celery\result.py", line 108, in ready
    return self.status in self.backend.READY_STATES
  File "C:\Python27\lib\site-packages\celery\result.py", line 196, in status
    return self.state
  File "C:\Python27\lib\site-packages\celery\result.py", line 191, in state
    return self.backend.get_status(self.task_id)
  File "C:\Python27\lib\site-packages\celery\backends\base.py", line 404, in _is
_disabled
    raise NotImplementedError("No result backend configured.  "
NotImplementedError: No result backend configured.  Please see the documentation
 for more information.

It is very strange because when I just run celeryd (with the same celery settings), it works just fine. Has anyone encountered this problem before?

Thanks in advance!

Answer

psekar picture psekar · Jan 8, 2013

I had the same problem while getting the result back from the celery task although the celery task was executed ( console logs). What i found was, i had the same setting CELERY_RESULT_BACKEND = "redis" in django settings.py but i had also instantiated celery in the tasks.py

celery = Celery('tasks', broker='redis://localhost') - which i suppose overrides the settings.py property and hence it was not configuring the backend server for my celery instance which is used to store the results.

i removed this and let django get celery get properties from settings.py and the sample code worked for me.