Celery 提示[ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61

 

这个原因是你在celery.py中的设置问题导致的

import os
from celery import Celery, platforms
from .settings import base


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pro.settings.development")



# app = Celery('pro')
app = Celery('pro', backend='redis://localhost:6379/1', broker='redis://localhost:6379/0')
app.config_from_object('django.conf:settings')
app.conf.broker_url = 'redis://localhost:6379'
app.conf.broker_transport_options = {'visibility_timeout': 43200}
app.conf.timezone = 'Asia/Shanghai'

app.autodiscover_tasks(lambda: base.INSTALLED_APPS)

platforms.C_FORCE_ROOT = True
app = Celery('ManagementSystem')

 

当这样设置 app时,它默认的连接地址就是  amqp://guest:**@127.0.0.1:5672//

所以我们需要修改一下

app = Celery('pro', backend='redis://localhost:6379/1', broker='redis://localhost:6379/0')

这样就ok了

你可能感兴趣的:(celery)