作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 Django + Celery 设置在使用 RabbitMQ 的生产中正常工作。
AFAIK,应该足以设置 CELERY_ALWAYS_EAGER
至 True
在本地 django 设置中,避免设置 RabbitMQ 进行开发。我已经这样做了,但是在任务上调用 .delay() 时,我得到:
Traceback (most recent call last):
File "lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "lib/python2.7/site-packages/django/views/generic/edit.py", line 215, in post
return self.form_valid(form)
File "app/web/views.py", line 188, in form_valid
form.send_email()
File "app/web/forms.py", line 17, in send_email
send_email.delay(mail, recipients, 'Contact %s' % name, comment)
File "lib/python2.7/site-packages/celery/app/task.py", line 453, in delay
return self.apply_async(args, kwargs)
File "lib/python2.7/site-packages/celery/app/task.py", line 559, in apply_async
**dict(self._get_exec_options(), **options)
File "lib/python2.7/site-packages/celery/app/base.py", line 353, in send_task
reply_to=reply_to or self.oid, **options
File "lib/python2.7/site-packages/celery/app/amqp.py", line 305, in publish_task
**kwargs
File "lib/python2.7/site-packages/kombu/messaging.py", line 172, in publish
routing_key, mandatory, immediate, exchange, declare)
File "lib/python2.7/site-packages/kombu/connection.py", line 457, in _ensured
interval_max)
File "lib/python2.7/site-packages/kombu/connection.py", line 369, in ensure_connection
interval_start, interval_step, interval_max, callback)
File "lib/python2.7/site-packages/kombu/utils/__init__.py", line 243, in retry_over_time
return fun(*args, **kwargs)
File "lib/python2.7/site-packages/kombu/connection.py", line 237, in connect
return self.connection
File "lib/python2.7/site-packages/kombu/connection.py", line 741, in connection
self._connection = self._establish_connection()
File "lib/python2.7/site-packages/kombu/connection.py", line 696, in _establish_connection
conn = self.transport.establish_connection()
File "lib/python2.7/site-packages/kombu/transport/librabbitmq.py", line 123, in establish_connection
conn = self.Connection(**opts)
File "lib/python2.7/site-packages/librabbitmq/__init__.py", line 199, in __init__
self.connect()
ConnectionError: Error opening socket: a socket error occurred
最佳答案
作为记录,自 celery 4.0此设置已重命名为 task_always_eager :
# setting renamed on celery 4.0
CELERY_ALWAYS_EAGER --> task_always_eager
# --django allows to keep uppercase settings and CELERY_ prefix
$ celery upgrade settings proj/settings.py --django
关于django - CELERY_ALWAYS_EAGER 好像没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30016887/
我有一个 Django + Celery 设置在使用 RabbitMQ 的生产中正常工作。 AFAIK,应该足以设置 CELERY_ALWAYS_EAGER至 True在本地 django 设置中,避
我正在运行 Django 1.8 + Celery 4.0.2Celery 配置良好,可以在 redis 后端本地运行我的 Django 任务。但是当我尝试使用 CELERY_ALWAYS_EAGER
我是一名优秀的程序员,十分优秀!