0

This is my tree (hidding all the unnecesary stuff):

src/
├─ api/
│  ├─ app1/
│  │  ├─ tasks.py
│  │  ├─ models.py
│  ├─ celeryworker/
│  │  ├─ celery.py
│  ├─ settings.py
│  ├─ urls.py
├─ manage.py
├─ setup.py

And then this is my celery.py

from __future__ import absolute_import
from celery import Celery
import os

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api.settings')

app = Celery('portal')

app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

when I am trying to run this app:

cd src/api
celery -A celeryworker worker --loglevel=INFO

I am getting:

 ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.

moreover, printing print(app.conf) doesn't seem to be setting any of my CELERY_ settings that I have specified in src/api/settings.py How can I make my celery worker read the Django settings properly?

2
  • 2
    What do the celery settings in settings.py look like? Commented Dec 10, 2021 at 2:05
  • :facepalm: I was missing some important settings in settings.py. this comment made me realize that, thanks. Commented Dec 10, 2021 at 2:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.