[英]Celery with Rabbit MQ Virtual Host not accepting tasks from app.tasks.py in Django
Help needed!需要帮助!
PS: I have already created Virtual Hosts using this link PS:我已经使用这个链接创建了虚拟主机
CELERY_BROKER_URL = 'amqp://flash:flash_education@localhost:5672/flash'
import os from celery import Celery从 celery 导入操作系统 导入 Celery
from django.conf import settings从 django.conf 导入设置
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
app = Celery(
'flash_education',
namespace='CELERY',
)
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
import datetime
import json
from celery import shared_task
@shared_task(name="ping")
def ping():
print("pong")
Attaching images from my terminal, one of of the worker instance other is of the shell from which I am firing the tasks.从我的终端附加图像,另一个工作实例之一是 shell,我从中触发任务。 Note: I started both after settings and all but it does not seem to work
注意:我在设置后都开始了,但它似乎不起作用
Worker terminal Screenshot工人终端截图
shell instance firing the request shell 实例触发请求
RabbitMQ, Celery==4.4.2 Django==3.0.4 Please help! RabbitMQ, Celery==4.4.2 Django==3.0.4 请帮忙!
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.
因此,解决方案是我错过了要添加到与 celery 相关的基础项目init .py中的设置。 Adding the details fixed my issue!
添加详细信息解决了我的问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.