ImportError:没有名为timeutils的模块

时间:2016-11-11 03:42:40

标签: python django celery django-celery

我尝试按照django-celery的教程安装。安装后我需要运行migrate来制作必要的表但出现错误:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
    django.setup()
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/djcelery/models.py", line 15, in <module>
    from celery.utils.timeutils import timedelta_seconds
ImportError: No module named timeutils

我没有在网上找到关于这个timeutils的任何内容

我正在使用:

django的== 1.9.8 Django的芹菜== 3.1.17

谢谢!

2 个答案:

答案 0 :(得分:29)

django-celery==3.1.17似乎不适用于较新版本的celery(请参阅this github issue)。

如果您可以使用早期版本的celery,则可以卸载当前版本,安装特定的旧版本,django-celery应该再次运行。例如:

$ pip uninstall celery
$ pip install celery==3.1

应该让问题重新开始,直到django-celery支持更新版本的celery

答案 1 :(得分:1)

对于Django == 1.9.8

$ pip install django-celery==3.1.17
$ pip uninstall celery
$ pip install celery==3.1.25