Reputation: 3033
I'm adding django-celery
to my project, there's currently an issue you'll experience where a first install of this installs an outdated celery
which you need to update and it has a dependency django-celery-results
which also has it's expected version for each depending on it's version.
I've ended up with the following versions
Name: django-celery-results
Version: 1.0.0
Name: django-celery
Version: 3.3.1
Name: celery
Version: 4.4.0
in my app/tasks.py I have the following code
from celery import shared_task
from django.conf import settings
@shared_task
def update_extend():
users = User.objects.filter(is_active=True)
for user in users:
....
based on the docs this seems like the next line of code to test
(fortnox) sam@sam:/media/veracrypt1/fortnox$ python manage.py celery
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/django/core/management/__init__.py", line 244, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/django/core/management/__init__.py", line 37, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/sam/code/envs/fortnox/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/djcelery/management/commands/celery.py", line 11, in <module>
class Command(CeleryCommand):
File "/home/sam/code/envs/fortnox/lib/python3.6/site-packages/djcelery/management/commands/celery.py", line 16, in Command
tuple(base.get_options()) +
TypeError: 'NoneType' object is not iterable
which throws the error shown above.
Upvotes: 1
Views: 2095
Reputation: 15728
django-celery
does not support Django versions higher than Django 1.10.* also does not support celery 4.*.*
From Celery documentation for Django
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 so this document only contains a basic way to integrate Celery and Django. You’ll use the same API as non-Django users so you’re recommended to read the First Steps with Celery tutorial first and come back to this tutorial. When you have a working example you can continue to the Next Steps guide.
You can still use django-celery-results
but withouth needs of djcelery
Upvotes: 3