Current version of celery and django-celery don't seem compatible

288 Views Asked by At

So I currently have installed Celery 3.1.8 (Cipater) and Djcelery 3.1.1 but following the tutorial causes my site to crash

So this tutorial http://docs.celeryproject.org/en/master/django/first-steps-with-django.html#django-first-steps

I pretty much follow but when I try importing django-celery with this line in settings.py

import djcelery

I get a server error. Looking at the error log it says

[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] mod_wsgi (pid=32567): Exception occurred processing WSGI script '/srv/www/site/app1/wsgi_app1.py'.
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] Traceback (most recent call last):
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi_app1.py", line 236, in __call__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]     self.load_middleware()
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]     self._setup(name)
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]     self._wrapped = Settings(settings_module)
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] ImportError: Could not import settings 'site.settings_app1' (Is it on sys.path?): cannot import name Celery
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] mod_wsgi (pid=32567): Exception occurred processing WSGI script '/srv/www/site/app1/wsgi_app1.py'.
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] Traceback (most recent call last):
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi_app1.py", line 236, in __call__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]     self.load_middleware()
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]     self._setup(name)
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]     self._wrapped = Settings(settings_module)
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] ImportError: Could not import settings 'site.settings_app1' (Is it on sys.path?): cannot import name Celery

I'm not sure how to even move on. That import is literally what's causing the problem and I need to use djcelery to utilize the Django backend stuff

Edit:

I'm aware that you don't need djcelery for most things but in the release notes for 3.1 it says http://docs.celeryproject.org/en/master/whatsnew-3.1.html#django-supported-out-of-the-box

Some features still require the django-celery library:

    Celery does not implement the Django database or cache result backends.

    Celery does not ship with the database-based periodic task

        scheduler.

And I want to use my DB as the backend

1

There are 1 best solutions below

0
On

Well, this still is an issue but I learned that you actually don't need django-celery at all to allow DB saves so I'm going to consider this answered