Django Celery
raw JSON → 3.3.1 verified Mon Apr 27 auth: no python deprecated
Legacy integration package for using Celery with Django. Current version 3.3.1 is deprecated; the project is in maintenance mode and no longer actively developed. Users should migrate to the built-in Celery integration available in Celery 3.1+. Release cadence: sporadic, last release in 2016.
pip install django-celery==3.3.1 Common errors
error ImportError: No module named djcelery ↓
cause django-celery not installed or not added to INSTALLED_APPS
fix
pip install django-celery and add 'djcelery' to INSTALLED_APPS
error RuntimeError: populate() isn't reentrant ↓
cause Calling djcelery.setup_loader() after Django apps have been populated, often in settings.py
fix
Move setup_loader() call to manage.py before execute_from_command_line() or upgrade to Celery native integration (no setup_loader needed).
Warnings
deprecated django-celery is deprecated. Use Celery's built-in Django support (installed_apps=['celery']) and Django 1.8+. ↓
fix Remove django-celery and use Celery directly: pip install celery[redis]; configure CELERY_BROKER_URL in settings; use from celery import Celery
breaking djcelery.setup_loader() cannot be called after Django apps are loaded (e.g., in settings). Placing it in settings.py can cause AppRegistryNotReady errors. ↓
fix Call setup_loader() in the manage.py or wsgi.py before django.setup(), or use the modern patten: from celery import Celery; app = Celery('proj'); app.config_from_object('django.conf:settings')
gotcha django-celery is incompatible with Celery 4.x. Attempting to install both will cause ImportError on 'fixups' or missing 'celery.current_app'. ↓
fix Use Celery >=4.0 with its native Django integration; remove django-celery from requirements.
Imports
- djcelery wrong
from celery import Celery (then using django-celery)correctfrom djcelery import celery
Quickstart
INSTALLED_APPS = ['djcelery']
import djcelery
djcelery.setup_loader()
from djcelery.models import PeriodicTask