
Django Celery Expert
Wire Celery into a Django project with broker, result backend, and autodiscovered task modules so background jobs run reliably.
Overview
Django Celery Expert is an agent skill for the Build phase that configures Celery inside Django projects with brokers, result backends, and autodiscovered tasks.
Install
npx skills add https://github.com/vintasoftware/django-ai-plugins --skill django-celery-expertWhat is this skill?
- Documents project layout with myproject/celery.py, __init__.py export, and per-app tasks.py
- Shows CELERY_-namespaced Django settings for Redis or RabbitMQ brokers and optional result backends
- Covers app.config_from_object, autodiscover_tasks(), and a bind=True debug_task pattern
- Includes serialization, timezone, and django-db result backend options for production-shaped setups
- Documents 4-file Django-Celery layout: celery.py, package __init__.py, settings block, and per-app tasks.py
Adoption & trust: 656 installs on skills.sh; 82 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have a Django app that must run work outside HTTP requests but lack a correct celery app bootstrap, broker settings, and task module layout.
Who is it for?
Solo builders adding Redis- or RabbitMQ-backed Celery to an existing Django repo who want the official integration files and settings in one pass.
Skip if: Teams that only need one-off scripts without Django, or production hardening guides for Kubernetes autoscaling and monitoring without any Django-Celery wiring.
When should I use this skill?
Setting up or fixing Django-Celery integration, broker/result backend configuration, or task autodiscovery in a Django project.
What do I get? / Deliverables
After applying the skill you get a working Celery app wired to Django settings, discovered tasks in installed apps, and verified broker or result-backend configuration ready for real background jobs.
- Configured myproject/celery.py and __init__.py exporting celery_app
- CELERY_* entries in settings.py for broker, serializers, and optional result backend
- App-level tasks.py modules discoverable by autodiscover_tasks
Recommended Skills
Journey fit
Celery integration is canonical Build work because it extends the Django backend with async workers, brokers, and task modules before ship. Backend is the right shelf for celery.py, settings namespaces, and app tasks.py—not frontend or pure DevOps deploy alone.
How it compares
Use instead of generic Celery docs when you need Django-specific celery.py, CELERY_ settings, and autodiscover_tasks—not a standalone Python worker tutorial.
Common Questions / FAQ
Who is django-celery-expert for?
It is for indie developers and small teams building Django APIs or SaaS who need background tasks, periodic jobs, or async pipelines integrated with their existing settings and apps.
When should I use django-celery-expert?
Use it during Build when you are creating celery.py, updating settings.py with CELERY_BROKER_URL, or organizing tasks.py per app before you ship workers to staging or production.
Is django-celery-expert safe to install?
Treat it like any third-party agent skill: review the Security Audits panel on this Prism page and your org policy before letting an agent apply broker URLs or run workers with network access.
SKILL.md
READMESKILL.md - Django Celery Expert
# Configuration Guide ## Django-Celery Integration Setup ### Project Structure ``` myproject/ ├── myproject/ │ ├── __init__.py │ ├── celery.py # Celery app configuration │ ├── settings.py │ └── urls.py ├── myapp/ │ ├── __init__.py │ ├── models.py │ └── tasks.py # App-specific tasks └── manage.py ``` ### Celery Application Setup ```python # myproject/celery.py import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') app = Celery('myproject') # Load config from Django settings with CELERY_ prefix app.config_from_object('django.conf:settings', namespace='CELERY') # Auto-discover tasks in all installed apps app.autodiscover_tasks() @app.task(bind=True, ignore_result=True) def debug_task(self): print(f'Request: {self.request!r}') ``` ```python # myproject/__init__.py from .celery import app as celery_app __all__ = ('celery_app',) ``` ### Django Settings ```python # settings.py # Broker Configuration (choose one) # Redis CELERY_BROKER_URL = 'redis://localhost:6379/0' # RabbitMQ CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//' # Result Backend (optional, needed if you track results) CELERY_RESULT_BACKEND = 'redis://localhost:6379/1' # Or use Django database CELERY_RESULT_BACKEND = 'django-db' # Serialization CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_ACCEPT_CONTENT = ['json'] # Timezone CELERY_TIMEZONE = 'UTC' CELERY_ENABLE_UTC = True # Task settings CELERY_TASK_TRACK_STARTED = True CELERY_TASK_TIME_LIMIT = 30 * 60 # 30 minutes hard limit CELERY_TASK_SOFT_TIME_LIMIT = 25 * 60 # 25 minutes soft limit ``` ## Broker Configuration ### Redis Broker ```python # Basic Redis CELERY_BROKER_URL = 'redis://localhost:6379/0' # Redis with password CELERY_BROKER_URL = 'redis://:password@localhost:6379/0' # Redis Sentinel for HA CELERY_BROKER_URL = 'sentinel://localhost:26379' CELERY_BROKER_TRANSPORT_OPTIONS = { 'master_name': 'mymaster', 'sentinel_kwargs': {'password': 'sentinel_password'}, } # Redis Cluster CELERY_BROKER_URL = 'redis://localhost:6379/0' CELERY_BROKER_TRANSPORT_OPTIONS = { 'cluster': True, } # Connection pool settings CELERY_BROKER_POOL_LIMIT = 10 CELERY_BROKER_CONNECTION_TIMEOUT = 10 CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True ``` ### RabbitMQ Broker ```python # Basic RabbitMQ CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//' # With virtual host CELERY_BROKER_URL = 'amqp://user:password@localhost:5672/myvhost' # RabbitMQ with SSL CELERY_BROKER_URL = 'amqp://user:password@localhost:5671//' CELERY_BROKER_USE_SSL = { 'keyfile': '/path/to/key.pem', 'certfile': '/path/to/cert.pem', 'ca_certs': '/path/to/ca.pem', 'cert_reqs': ssl.CERT_REQUIRED, } # Connection pool CELERY_BROKER_POOL_LIMIT = 10 CELERY_BROKER_HEARTBEAT = 10 # Confirm message delivery (recommended for reliability) CELERY_BROKER_TRANSPORT_OPTIONS = { 'confirm_publish': True, } ``` ## Broker Transport Options Critical settings for message delivery reliability. ### Redis Visibility Timeout When using Redis, set `visibility_timeout` to control how long a task remains invisible after being picked up. If a worker crashes before acknowledging, the task becomes visible again after this timeout. ```python # Redis visibility timeout (default: 1 hour) CELERY_BROKER_TRANSPORT_OPTIONS = { 'visibility_timeout': 3600, # 1 hour in seconds } ``` **Important:** Set visibility timeout longer than your longest task. If a task takes longer than the timeout, it will be redelivered to another worker while still running. ### RabbitMQ Publisher Confirms Enable publisher confirms to ensure messages are actually delivered to the broker. ```python # RabbitMQ: confirm message delivery CELERY_BROKER_TRANSPORT_OPTIONS = { 'confirm_publish': True, } ``` ### SQS Configuration ```python # AWS SQS CELERY_BROKER_URL = 'sqs://aws_access_key:aws_secret_key@' CELERY_BROKER_TRANSPORT_OPTIONS = {