简体   繁体   中英

django 1.11 with celery 4.0 and djcelery compatibility issues

I currently use django 1.11 and I'm forced to use an older version of celery (3.1) for compatibility reasons.

I want to upgrade to celery 4.0 because another part of our application needs the later version of celery.

Is there a combination of celery, django-celery and django 1.11 that is compatible? The docs say that celery 4.0 is compatible with all versions of django from 1.8 onwards, but this does not seem to be the case.

Errors occur for example when I use:

python manage.py makemigrations <appname>

Here is the error message I get:

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

If I revert back to celery 3.1, it works.

... File "/usr/local/lib/python2.7/dist-packages/ djcelery /managers.py", line 18, in ...

You are using django-celery , a library which is 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 ...

Remove djcelery from INSTALLED_APPS , follow the linked document to see if anything else needs an update and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM