报错1 - TypeError:can only concatenate list (not ‘tuple’) to list
参考:
https://stackoverflow.com/questions/49085230/django-celery-typeerror-can-only-concatenate-tuple-not-nonetype-to-tuple
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
解决:
将 djcelery\management\commands\celery.py
中的 options
部分注释掉
报错2 - from kombu.async.timer import Entry, Timer as Schedule, to_timestamp, logger SyntaxError: invalid syntax
参考
https://stackoverflow.com/questions/53466160/unable-to-start-celery-worker-instance-syntax-error
原因是版本冲突。要降低版本
降低python版本
报错3 - Running a worker with superuser privileges when the worker accepts messages serialized with pickle is a very bad idea!
如果使用root用户启动celery会遇到下面的问题
from celery import Celery, platforms
platforms.C_FORCE_ROOT = True #加上这一行
错误4 - from . import async, base SyntaxError: invalid syntax错误
参考:
解决:
pip install --upgrade https://github.com/celery/celery/tarball/master
错误5 - django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
错误解决:
-
首先到系统根目录
cd /
-
然后查找django
find -name django
因为我实在虚拟环境cel下开发本项目,所以我django再上图所示的路径中。 -
编辑该路径下的
/db/backends/sqlite3/base.py
文件vim ./root/.local/share/virtualenvs/cel-l64ISTw0/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py
找到check_sqlite_version()
方法,注释掉里面的报错代码def check_sqlite_version(): pass # if Database.sqlite_version_info < (3, 8, 3): # raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
重新运行项目
python manage.py runserver
访问http:127.0.0.1:8000/
错误6 - AttributeError: ‘str’ object has no attribute ‘items’
原因:
redis版本问题
解决:回滚到旧版本
pip install redis==2.10.6