运行 celeryd 时出错
我发布这个问题(和答案),这样如果其他人将来遇到这个问题,你就可以用谷歌搜索它。
如果您尝试在 Django 中运行 celeryd,如下所示:
python manage.py celeryd
您可能会在启动后立即收到以下错误:
celery@eric-desktop-dev has started.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
<... snip ...>
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/connection.py", line 134, in __init__
self._x_start_ok(d, login_method, login_response, locale)
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/connection.py", line 704, in _x_start_ok
args.write_longstr(response)
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/serialization.py", line 352, in write_longstr
self.write_long(len(s))
TypeError: object of type 'NoneType' has no len()
一条相当神秘的错误消息,没有真正的线索说明在哪里解决问题。请参阅下面的答案,这样您就不会像我今天一样在这个错误上浪费大量时间:)
I'm posting this question (and answer) so if anybody else has this problem in the future, you'll be able to google it.
If you are trying to run celeryd in Django like so:
python manage.py celeryd
You can receive the following error immediately after it has started:
celery@eric-desktop-dev has started.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
<... snip ...>
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/connection.py", line 134, in __init__
self._x_start_ok(d, login_method, login_response, locale)
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/connection.py", line 704, in _x_start_ok
args.write_longstr(response)
File "/usr/local/lib/python2.6/dist-packages/amqplib-0.6.1-py2.6.egg/amqplib/client_0_8/serialization.py", line 352, in write_longstr
self.write_long(len(s))
TypeError: object of type 'NoneType' has no len()
A rather cryptic error message, with no real clue as to where to go to fix the problem. See below for the answer so you don't waste a bunch of time on this error like I did today :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在
settings.py
中缺少 celery 设置。就我而言,这是由拼写错误引起的(我在 BROKER_PASSWORD 中漏掉了“S”)。仔细检查您是否包含了所有必需的设置,并且每一项都拼写正确,这样您就可以避免像我今天那样出丑:)You're missing a celery setting in
settings.py
. In my case it was caused by a typo (I missed an 'S' in BROKER_PASSWORD). Double check you included all the required settings and that each one is spelled everything correctly, and you'll avoid making as ass of yourself like I did today :)