python manage.py celery worker -l INFO必报这个错

来源:4-1 Django 中配置使用 Celery

网络侦探

2018-12-18 15:12

环境:python3.6+django.2.0,是不是Django 版本太高了, 我看视频用的1.8


[2018-12-18 15:04:36,822: WARNING/MainProcess] /Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/billiard/__init__.py:321: RuntimeWarning: force_execv is not supported as the billiard C extension is not installed


  warnings.warn(RuntimeWarning(W_NO_EXECV))


[2018-12-18 15:04:37,099: INFO/MainProcess] Connected to redis://:**@127.0.0.1:6379/1


[2018-12-18 15:04:37,111: INFO/MainProcess] mingle: searching for neighbors


[2018-12-18 15:04:38,119: INFO/MainProcess] mingle: all alone


[2018-12-18 15:04:38,131: WARNING/MainProcess] /Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/djcelery/loaders.py:133: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!


  warn('Using settings.DEBUG leads to a memory leak, never '


[2018-12-18 15:04:38,131: WARNING/MainProcess] celery@TesterCCdeMacBook-Pro.local ready.


[2018-12-18 15:04:39,732: ERROR/MainProcess] Unrecoverable error: AttributeError("'str' object has no attribute 'items'",)


Traceback (most recent call last):


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/__init__.py", line 206, in start


    self.blueprint.start(self)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start


    step.start(parent)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 374, in start


    return self.obj.start()


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/consumer.py", line 280, in start


    blueprint.start(self)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start


    step.start(parent)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/consumer.py", line 884, in start


    c.loop(*c.loop_args())


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/celery/worker/loops.py", line 76, in asynloop


    next(loop)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/async/hub.py", line 340, in create_loop


    cb(*cbargs)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/redis.py", line 1019, in on_readable


    self._callbacks[queue](message)


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/virtual/__init__.py", line 534, in _callback


    self.qos.append(message, message.delivery_tag)


  File "/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/kombu/transport/redis.py", line 146, in append


    pipe.zadd(self.unacked_index_key, delivery_tag, time()) \


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/redis/client.py", line 2263, in zadd


    for pair in iteritems(mapping):


  File "/Development/virtualenv_workspace/py36dj2/lib/python3.6/site-packages/redis/_compat.py", line 123, in iteritems


    return iter(x.items())


AttributeError: 'str' object has no attribute 'items'


写回答 关注

3回答

  • 慕尼黑2271025
    2019-04-25 23:36:03

    django 2.1.7 

    python 3.6.5

    redis 2.10.0


    小鹏友i

    请问 您的问题解决了吗 我也遇到了类似的问题 我的是Django==1.11 redis==3.2.1 python 3.5

    2019-04-29 15:38:12

    共 1 条回复 >

  • 慕尼黑2271025
    2019-04-25 23:35:13

    不行啊,还是报错


  • 慕侠1439365
    2019-01-07 11:18:22

    这是因为pip install redis 的版本过高

    使用2.10版本即 pip install redis==2.10即可

Python 异步任务队列 Celery 使用

Python 异步任务队列神器 celery 的使用

10849 学习 · 43 问题

查看课程

相似问题