0

My django project is cloned from Celery repo: https://github.com/celery/celery/tree/3.1/examples/django . In settings after const BROKER_URL I added

CELERY_RESULT_BACKEND = 'amqp://'

I'm trying task called 'add' from the project. Inside worker terminal result is ok but can't get it back. I call command something like this:

from demoapp.tasks import add
add.delay(2,2)
add.AsyncResult(a.task_id).get()

But don't know why I get error:

<ipython-input-3-5f18de09f6a1> in <module>()
----> 1 add.AsyncResult(a.task_id).get()

/home/t/py/django/celeryexample/venv/lib/python2.7/site-packages/celery/result.pyc in get(self, timeout, propagate, interval, no_ack, follow_parents, EXCEPTION_STATES, PROPAGATE_STATES)
    167             interval=interval,
    168             on_interval=on_interval,
--> 169             no_ack=no_ack,
    170         )
    171         if meta:

/home/t/py/django/celeryexample/venv/lib/python2.7/site-packages/celery/backends/base.pyc in _is_disabled(self, *args, **kwargs)
    595     def _is_disabled(self, *args, **kwargs):
    596         raise NotImplementedError(
--> 597             'No result backend configured.  '
    598             'Please see the documentation for more information.')
    599     wait_for = get_status = get_result = get_traceback = _is_disabled

NotImplementedError: No result backend configured.  Please see the documentation for more information

3 Answers 3

2

I ran task from ipython instead manage.py shell so that's the issue

Sign up to request clarification or add additional context in comments.

1 Comment

Damn, I thought it works from a normal shell and was struggling to fix a non-existing problem.
1
pip install 'django_celery_results'

add django_celery_results in INSTALLED_APPS in settings.py(it will create one table to store result)

Set celery result as below in settings.py of your procject

CELERY_RESULT_BACKEND = 'django-db'

python manage.py makemigrations
python manage.py migrate

restart worker ..Done

Comments

0

You're getting this error because you're setting the backend to use a AMPQ compatible backing storage, which you don't have. Usual AMPQ storage is RabbitMQ but there are others like ActiveMQ, Apollo etc.

I recommend not to use AMPQ for persistence, unless you have a dedicated server.

You can instead use a database or redis for storing the results. For testing purposes you can use SQLite,

CELERY_RESULT_BACKEND = 'db+sqlite:///results.db'

From celery docs

1 Comment

i have AMPQ server, but when I changed to sqllite config I have the same error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.