运行 celeryd 时出错

发布于 2024-09-04 12:35:19 字数 1003 浏览 4 评论 0原文

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

如果您尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽梦忆笙歌 2024-09-11 12:35:19

您在 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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文