Django Celery在runserver命令上导致导入错误

时间:2010-10-25 16:25:53

标签: python django celery importerror

当我发出runserver命令时,会从djcelery(Django Celery)引发ImportError。

% python manage.py runserver                                                                                                            
~/Workspace/django-projects/no-labels/src
Validating models...
Unhandled exception in thread started by <function inner_run at 0x1ef7320>
Traceback (most recent call last):
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 48, in inner_run
    self.validate(display_num_errors=True)
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/db/models/loading.py", line 146, in get_app_errors
    self._populate()
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/db/models/loading.py", line 64, in _populate
    self.load_app(app_name)
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/db/models/loading.py", line 78, in load_app
    models = import_module('.models', app_name)
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/damon/Workspace/django-projects/no-labels/env/lib/python2.6/site-packages/djcelery/models.py", line 14, in <module>
    from celery.app import default_app
ImportError: No module named app

手动尝试在python控制台中导入celery.app.default_app时会出现同样的问题:

>>> from celery.app import default_app
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named app

1 个答案:

答案 0 :(得分:3)

celery.app仅在9月14日添加。您需要运行从那时起发布的芹菜副本。