[Django]-Celery with redis backend

4πŸ‘

βœ…

In ubuntu 10.10 when you install redis it automatically starts at boot, and it was conflicting with celery because apparently even if you tell it to use this or that port if celery can connect to redis in 6379 port it will use it as a backend. I’ve not seen the code but is my conclusion.
So i closed all the redis instances ran my own with my redis.conf on whatever port i want and then i put these on my settings.

BROKER_URL = 'redis://localhost:8889/0'
REDIS_DB = 0
REDIS_CONNECT_RETRY = True
CELERY_RESULT_BACKEND = 'redis'
CELERY_REDIS_PORT = 8889
BROKER_PORT = 8889
CELERY_RESULT_PORT = 8889
CELERY_TASK_RESULT_EXPIRES = 10
CELERYBEAT_SCHEDULER= 'djcelery.schedulers.DatabaseScheduler'

7πŸ‘

Do you have import djcelery; djcelery.setup_loader() in your settings.py?

You can find out where it is trying to connect by running the following:

 $ python manage.py celeryctl shell

 >>> celery.broker_connection().as_uri()

The β€˜setup_loader’ is very important, so you must make sure that you include it.

(the good news is that celery will support Django out of the box for version 2.7).

πŸ‘€asksol

0πŸ‘

What version of celery are you using? In the development version it looks like they use a different Decorator;

from celery.task import task

@celery.task()
def add(x, y):
    return x + y
πŸ‘€Michael

0πŸ‘

Are you starting the Redis server on the port 8889?

πŸ‘€Kalail

Leave a comment