Help needed!
PS: I have already created Virtual Hosts using this link
Celery and Vhosts
settings.py
JavaScript
x
2
1
CELERY_BROKER_URL = 'amqp://flash:flash_education@localhost:5672/flash'
2
celery.py
import os from celery import Celery
from django.conf import settings
JavaScript
1
8
1
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
2
app = Celery(
3
'flash_education',
4
namespace='CELERY',
5
)
6
app.config_from_object('django.conf:settings')
7
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
8
app1.tasks.py
JavaScript
1
9
1
import datetime
2
import json
3
4
from celery import shared_task
5
6
@shared_task(name="ping")
7
def ping():
8
print("pong")
9
Attaching images from my terminal, one of of the worker instance other is of the shell from which I am firing the tasks. Note: I started both after settings and all but it does not seem to work
shell instance firing the request
RabbitMQ, Celery==4.4.2 Django==3.0.4 Please help!
Advertisement
Answer
I might be late! So the Solution to this was that I missed the settings to be added in the base project init.py pertaining to celery. Adding the details fixed my issue!