7π
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.
4π
If youβre just running the samples from http://www.celeryproject.org/tutorials/first-steps-with-celery/, you need to run the console via manage.py:
% python manage.py shell
- [Django]-A field with precision 10, scale 2 must round to an absolute value less than 10^8
- [Django]-How can I create a deep clone of a DB object in Django?
- [Django]-No handlers could be found for logger
2π
For those who are in a desperate search for a solution like I was.
Put this line at the end of the settings.py
script:
djcelery.setup_loader()
Looks like django-celery is not going to consider itβs own settings without a strict order.
- [Django]-Nginx doesn't serve static
- [Django]-Django Multiple Authentication Backend for one project
- [Django]-Django return file over HttpResponse β file is not served correctly
2π
In my case, the problem was that I was passing the CELERY_RESULT_BACKEND argument to the celery constructor:
Celery('proj',
broker = 'amqp://guest:guest@localhost:5672//',
CELERY_RESULT_BACKEND='amqp://',
include=['proj.tasks'])
The solution was to use the backend argument instead:
Celery('proj',
broker = 'amqp://guest:guest@localhost:5672//',
backend='amqp://',
include=['proj.tasks'])
- [Django]-Django Form File Field disappears on form error
- [Django]-Get object by field other than primary key
- [Django]-How do I use django rest framework to send a file in response?
1π
For users encountering this issue in 2023. If you are using Celery version 5.0 or greater, set CELERY_RESULT_BACKEND = "rpc://" in settings. If you are initializing the celery app, use the below code:
Celery('your_project_name',
broker = 'amqp://guest:guest@localhost:5672//',
backend='rpc://',
include=['proj.tasks'])
- [Django]-Sending post data from angularjs to django as JSON and not as raw content
- [Django]-Django custom management commands: AttributeError: 'module' object has no attribute 'Command'
- [Django]-Django-tables2: How to use accessor to bring in foreign columns?
0π
Some how the console has to have django environment set up in order to pick up the settings. For example, in PyCharm you can run django console, in which everything works as expected.
- [Django]-How to specify an IP address with Django test client?
- [Django]-Heroku, postgreSQL, django, comments, tastypie: No operator matches the given name and argument type(s). You might need to add explicit type casts
- [Django]-What is a django.utils.functional.__proxy__ object and what it helps with?
0π
See AMQP BACKEND SETTINGS for better understanding
Note The AMQP backend requires RabbitMQ 1.1.0 or higher to
automatically expire results. If you are running an older version of
RabbitMQ you should disable result expiration like this:
CELERY_TASK_RESULT_EXPIRES = None
Try adding the below line to your settings.py:
CELERY_TASK_RESULT_EXPIRES = 18000 # 5 hours
- [Django]-Django south migration β Adding FULLTEXT indexes
- [Django]-Error: could not determine PostgreSQL version from '10.3' β Django on Heroku
- [Django]-Extend base.html problem