django 1.11 与 celery 4.0 和 djcelery 兼容性问题
django 1.11 with celery 4.0 and djcelery compatibility issues
我目前使用的是 django 1.11,出于兼容性原因,我不得不使用旧版本的 celery (3.1)。
我想升级到celery 4.0,因为我们应用程序的另一部分需要更高版本的celery。
是否有兼容的 celery、django-celery 和 django 1.11 的组合?文档说 celery 4.0 从 1.8 开始兼容所有版本的 django,但事实似乎并非如此。
例如当我使用时出现错误:
python manage.py makemigrations <appname>
这是我收到的错误消息:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 337, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/djcelery/models.py", line 16, in <module>
from . import managers
File "/usr/local/lib/python2.7/dist-packages/djcelery/managers.py", line 18, in <module>
from celery.utils.timeutils import maybe_timedelta
ImportError: No module named timeutils
如果我恢复到 celery 3.1,就可以了。
... File "/usr/local/lib/python2.7/dist-packages/djcelery/managers.py", line 18, in ...
您正在使用 django-celery
,一个 no longer required since celery 3.1
的库
Previous versions of Celery required a separate library to work with
Django, but since 3.1 this is no longer the case. Django is supported
out of the box now ...
从 INSTALLED_APPS
中删除 djcelery
,按照链接文档查看是否还有其他需要更新的内容,它应该可以工作。
我目前使用的是 django 1.11,出于兼容性原因,我不得不使用旧版本的 celery (3.1)。
我想升级到celery 4.0,因为我们应用程序的另一部分需要更高版本的celery。
是否有兼容的 celery、django-celery 和 django 1.11 的组合?文档说 celery 4.0 从 1.8 开始兼容所有版本的 django,但事实似乎并非如此。
例如当我使用时出现错误:
python manage.py makemigrations <appname>
这是我收到的错误消息:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 337, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/djcelery/models.py", line 16, in <module>
from . import managers
File "/usr/local/lib/python2.7/dist-packages/djcelery/managers.py", line 18, in <module>
from celery.utils.timeutils import maybe_timedelta
ImportError: No module named timeutils
如果我恢复到 celery 3.1,就可以了。
... File "/usr/local/lib/python2.7/dist-packages/djcelery/managers.py", line 18, in ...
您正在使用 django-celery
,一个 no longer required since celery 3.1
Previous versions of Celery required a separate library to work with Django, but since 3.1 this is no longer the case. Django is supported out of the box now ...
从 INSTALLED_APPS
中删除 djcelery
,按照链接文档查看是否还有其他需要更新的内容,它应该可以工作。