setting up django celery error running instance -
i'm learning how setup django-celery , i'm getting error
[tasks] . revamp.celery.debug_task [2017-08-20 05:58:06,216: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 2.00 seconds... [2017-08-20 05:58:08,230: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 4.00 seconds... [2017-08-20 05:58:12,245: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 6.00 seconds... [2017-08-20 05:58:18,263: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 8.00 seconds... [2017-08-20 05:58:26,283: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 10.00 seconds... [2017-08-20 05:58:36,312: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 111] connection refused. trying again in 12.00 seconds...
here's docs http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
when run command when error above appears
celery -a revamp worker -l info
my django project called revamp , in revamp/revamp/celery.py here's code
from __future__ import absolute_import import os celery import celery django.conf import settings # set default django settings module 'celery' program. os.environ.setdefault('django_settings_module', 'revamp.settings') app = celery('revamp') # using string here means worker not have # pickle object when using windows. app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.installed_apps) @app.task(bind=true) def debug_task(self): print('request: {0!r}'.format(self.request))
this because celery app cannot find message broker. please install rabbitmq-server(sudo apt-get install rabbitmq-server) , start(sudo service rabbitmq-server start) it. if installed restarting solve issue.
Comments
Post a Comment