关于celery django django-celery版的搭配的报错问题及解决方法

时间:2021-06-21 06:25:00

G:\python3_django\DFpro\mypro (win)(py3_django) λ python manage.py celery worker --loglevel=infoTraceback (most recent call last):  File "manage.py", line 10, inexecute_from_command_line(sys.argv)  File "C:\virtualenv\py3_django\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line    utility.execute()  File "C:\virtualenv\py3_django\lib\site-packages\django\core\management\__init__.py", line 356, in execute    self.fetch_command(subcommand).run_from_argv(self.argv)  File "C:\virtualenv\py3_django\lib\site-packages\django\core\management\__init__.py", line 206, in fetch_command    klass = load_command_class(app_name, subcommand)  File "C:\virtualenv\py3_django\lib\site-packages\django\core\management\__init__.py", line 40, in load_command_class    module = import_module('%s.management.commands.%s' % (app_name, name))  File "C:\virtualenv\py3_django\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "", line 978, in _gcd_import  File "", line 961, in _find_and_load  File "", line 950, in _find_and_load_unlocked  File "", line 655, in _load_unlocked  File "", line 678, in exec_module  File "", line 205, in _call_with_frames_removed  File "C:\virtualenv\py3_django\lib\site-packages\djcelery\management\commands\celery.py", line 6, infrom djcelery.management.base import CeleryCommand  File "C:\virtualenv\py3_django\lib\site-packages\djcelery\management\base.py", line 59, inclass CeleryCommand(BaseCommand):

File "C:\virtualenv\py3_django\lib\site-packages\djcelery\management\base.py", line 60, in CeleryCommand

options = BaseCommand.option_list

AttributeError: type object 'BaseCommand' has no attribute 'option_list'

解决办法:pip install django==1.8

原因:

Celery == 3.1 django == 1.10 django-celery == 3.1.17

这个搭配运行有问题

BaseCommand.option_list在Django 1.8中被弃用,并在Django 1.10中删除。看起来Django的扩展已经更新,但从那以后还没有一个新的版本。