gpt4 book ai didi

django 1.11 与 celery 4.0 和 djcelery 兼容性问题

转载 作者:行者123 更新时间:2023-12-02 02:01:15 26 4
gpt4 key购买 nike

我目前使用 django 1.11,出于兼容性原因,我被迫使用旧版本的 celery (3.1)。

我想升级到 celery 4.0,因为我们应用程序的另一部分需要更高版本的 celery。

是否存在兼容的 celery、django-celery 和 django 1.11 的组合?文档说 celery 4.0 与 django 1.8 以后的所有版本兼容,但情况似乎并非如此。

例如,当我使用时会发生错误:

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 4.0 和 djcelery 兼容性问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44188111/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com