3

我发布了这个问题(和答案),所以如果将来有人遇到这个问题,你可以用谷歌搜索它。

如果您尝试像这样在 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()

一条相当神秘的错误消息,没有真正的线索去解决问题。请参阅下面的答案,这样您就不会像我今天那样在此错误上浪费大量时间 :)

4

1 回答 1

1

你在settings.py. 就我而言,这是由错字引起的(我错过了 BROKER_PASSWORD 中的“S”)。仔细检查您是否包含了所有必需的设置,并且每个设置都正确拼写,并且您将避免像我今天那样做自己的屁股:)

于 2010-06-01T19:00:44.613 回答