celery:Unrecoverable error: AttributeError("'unicode' object has no attribute 'iteritems')

環境描述python

python2+django1.9下使用celery異步處理耗時請求。
celery使用的是celery-with-redis這個第三方庫,版本號爲3.0。git

pip install celery-with-redis

這樣安裝會將redis、celery-with-redis、redis等一塊兒同時安裝。github

錯誤描述redis

錯誤提示:Unrecoverable error: AttributeError("'unicode' object has no attribute 'iteritems')django

問題發現及解決bash

將這個錯誤Google後,在stackoverflow中發現瞭解決辦法,地址:stack overflowcelery-github
問題的癥結是redis的版本號爲3.0以上,致使celery將其做爲消息中間件的時候出現問題,給出的解決方案是安裝3.0如下的redis版本。這裏咱們安裝redis==2.10.6異步

  • 首先
pip uninstall redis
  • 其次
pip install redis==2.10.6
  • 最後
    從新運行celery便可。
celery worker -A xxx -l INFO
相關文章
相關標籤/搜索