Django Celery - Cannot connect to amqp://[email protected]:5672//

Solution 1:

Update Jan 2022: This answer is outdated. As suggested in comments, please refer to this link

The problem is that you are trying to connect to a local instance of RabbitMQ. Look at this line in your settings.py

BROKER_URL = 'amqp://guest:guest@localhost:5672/'

If you are working currently on development, you could avoid setting up Rabbit and all the mess around it, and just use a development version of a message queue with the Django database.

Do this by replacing your previous configuration with:

BROKER_URL = 'django://'

...and add this app:

INSTALLED_APPS += ('kombu.transport.django', )

Finally, launch the worker with:

./manage.py celery worker --loglevel=info

Source: http://docs.celeryproject.org/en/latest/getting-started/brokers/django.html

Solution 2:

I got this error because rabbitmq was not started. If you installed rabbitmq via brew you can start it using brew services start rabbitmq