After updating celery and django-celery to 3.1:
$ pip freeze | grep celery
celery==3.1.18
django-celery==3.1.16
I run into this error when starting my server:
Traceback (most recent call last):
File "app/manage.py", line 16, in <module>
execute_from_command_line(sys.argv)
[...]
File "/Users/xxx/.virtualenvs/yyy/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/Users/xxx/.virtualenvs/yyy/lib/python2.7/site-packages/django/conf/__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named five
Using:
Last version of vine is 5.0.0 and fresh push was in 06.09.2020 (yesterday) :), and this version do not have any five.py
file. So downgrade vine version to.
vine==1.3.0
works for me
UPDATE: by the answer Sarang, amqp and celery now requires vine>=5.0.0
Some suggestions found in internet were:
Reinstall both (because of a celery and django-celery version mismatch)
Upgrade celery
What worked for me was to upgrade kombu:
pip install kombu -U
NOTE: after updating to celery 3.1, django is supported out of the box.
You need to create a celery app according to new celery setup. Create a file celery.py in your project folder with settings.
from __future__ import absolute_import
import os
import sys
from celery import Celery
sfile = 'mysettings_file' # override it
os.environ.setdefault('DJANGO_SETTINGS_MODULE', sfile)
from django.conf import settings
project_name = 'referral' # override it
app = Celery(project_name)
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda : settings.INSTALLED_APPS)
In your app/tasks.py
, add your task
from referral import celery_app # substitute your project folder
class MyTask(celery_app.Task):
pass
Then, use this app to register your tasks. Infact, you don't need djcelery
if you want to use celery with django, unless you are using it as database backend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With