Settings

Celery result backend

Django Celery Logs is intended to replace Celery result-backend storage for task inspection. Configure Celery to ignore the default result backend and serialize task data as JSON:

CELERY_TASK_IGNORE_RESULT = True
CELERY_RESULT_SERIALIZER = "json"

Do not enable other Celery result apps in INSTALLED_APPS for the same purpose. For example, remove django_celery_results if it is installed. Only django_celery_logs should be added, as shown in the Django app section below.

If these settings exist, remove them unless another part of your project really depends on them:

CELERY_RESULT_BACKEND = "..."
CELERY_CACHE_BACKEND = "..."

Django app

Add the app to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_celery_logs",
    ...
]

Django 4.2+ automatically loads django_celery_logs.apps.CeleryLogsConfig for this app. The app config imports django_celery_logs.signals in ready(), which registers the Celery signal handlers.

Run migrations:

python manage.py migrate

Log retention

Optionally configure how many days logs are retained by the cleanup task:

CELERY_TASK_LOGS_EXPIRES = 7

If this setting is not defined, the app uses 2 days by default.