Keshav Agrawal
Keshav Agrawal

Reputation: 597

Celery not respecting BROKER_URL

I tried to search the relative questions on stackoverflow and on google but didn't find something which could solve my issue.

I have BROKER_URL set in my /etc/default/celeryd configuration as redis. BROKER_URL="redis://localhost:6379"

But when I start /etc/init.d/celeryd start

it says: "ERROR/MainProcess] consumer: Cannot connect to amqp://[email protected]:5672//:"

Also on the docs page I saw about celeryconfig.py. I don't understand why should I have two config files? /etc/default/celeryd is there for configuration.

Upvotes: 4

Views: 3363

Answers (2)

kigawas
kigawas

Reputation: 1258

You can try CELERY_BROKER_URL instead of BROKER_URL if you set the namespace like app.config_from_object("django.conf:settings", namespace="CELERY").

Ref: http://docs.celeryproject.org/en/latest/history/whatsnew-4.0.html#latentcall-django-admonition

Upvotes: 4

wolverdude
wolverdude

Reputation: 1663

Make sure you're not setting broker when defining your app. This one bit me when I copied and pasted code from the tutorial. It took me hours to realize I was overriding my own configuration with this line:

app = Celery('tasks', broker='amqp://guest@localhost//')

It should say this:

app = Celery('tasks')

Upvotes: 1

Related Questions