[Django]-Celery use wrong broker

3👍

The problem was that i missed celery in __init__.py. __init__.py should contain following ( from the docs ):

from __future__ import absolute_import

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app

2👍

Ensure the broker url on you config or settings file has the specified prefix as on the namespace app.config_from_object('django.conf:settings', namespace='CELERY')
so changed my BROKER_URL to CELERY_BROKER_URL

0👍

In my case the wrong broker issue was due to incorrect celery start command.

I’ve used ‘celery beat -A=myapp’, and broker was incorrect. Then i changed it to ‘celery -A myapp beat’ and it used correct broker from settings.

👤Tosh

0👍

It may cuased by kombu.

at first my env were:
kombu-4.6.11
celery-4.4.7

celery could not get settings by config_from_object !

after changed to:
kombu-4.0.2
celery-4.0.2

problem solved!

Leave a comment