使用Django的manage.py命令运行Celery时,它会返回一个奇怪的错误

时间:2010-10-26 03:12:11

标签: python django celery

当我运行以下命令时,会产生以下错误:

% python manage.py celeryd -l INFO                                                                                                     ~/Workspace/django-projects/project/src
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/djcelery/management/commands/celeryd.py", line 13, in <module>
    class Command(CeleryCommand):
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/djcelery/management/commands/celeryd.py", line 17, in Command
    option_list = CeleryCommand.option_list + worker.get_options()
  File "/home/damon/Workspace/django-projects/project/env/lib/python2.6/site-packages/celery/bin/celeryd.py", line 89, in get_options
    conf = self.app.conf
AttributeError: 'NoneType' object has no attribute 'conf'

以下是版本信息:

% python                                                                                                                               ~/Workspace/django-projects/project/src
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import celery
>>> print celery.VERSION
(2, 2, 0, 'a1')
>>> import djcelery
>>> print djcelery.VERSION
(2, 2, 0, 'a1')

1 个答案:

答案 0 :(得分:1)

应该很容易修复:只需升级你的django-celery安装。