我发布了这个问题(和答案),所以如果将来有人遇到这个问题,你可以用谷歌搜索它。
如果您尝试像这样在 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()
一条相当神秘的错误消息,没有真正的线索去解决问题。请参阅下面的答案,这样您就不会像我今天那样在此错误上浪费大量时间 :)