检查是否为Django的版本问题,celery在1.10以上的版本都已经被弃用了,使用pip install django==1.8.2,装回1.8的版本,完美解决这个bug
(h1) python@ubuntu:~/Desktop/django/test6$ python manage.py celery worker --loglevel=info
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 206, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 6, in <module>
from djcelery.management.base import CeleryCommand
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/base.py", line 59, in <module>
class CeleryCommand(BaseCommand):
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/base.py", line 60, in CeleryCommand
options = BaseCommand.option_list
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
(h1) python@ubuntu:~/Desktop/django/test6$ python manage.py celery worker --loglevel=info
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 206, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 6, in <module>
from djcelery.management.base import CeleryCommand
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/base.py", line 59, in <module>
class CeleryCommand(BaseCommand):
File "/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/djcelery/management/base.py", line 60, in CeleryCommand
options = BaseCommand.option_list
AttributeError: type object 'BaseCommand' has no attribute 'option_list'