django-celery
Skill0 starsChanged 2 months agoMITView on GitHub
Run Django jobs in the background with Celery. Covers task queues, workers, retries, schedules, and Redis or RabbitMQ.
- Installs packages
6 other projects use a version of this.
Adopted by
Most recently taken up by
- AndresArreguy/ecc-pi-porttheir own version, first seen Nov 16, 2026
- renepf/claude-skillstheir own version, first seen Oct 25, 2026
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- gongyijie85/dsh-ecctheir own version, first seen Oct 13, 2026
- Fmarzochi/EGCtheir own version, first seen Sep 16, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- Fmarzochi/EGC★ 61same name
- gongyijie85/dsh-ecc★ 8same name
- AndresArreguy/ecc-pi-port★ 1same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- davidanthonyn/claude-skills★ 0same name
- renepf/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 15 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use Celery to run slow Django work outside web requests.
- Distinctive: line 15
call an API without making the user wait.
- Distinctive: line 16
Run jobs at set times.
- Distinctive: line 19
Do not use Celery for work that must finish before the page loads.
- Distinctive: line 39
Add this to Django settings:
- Distinctive: line 48
Keep the broker URL in an env file when it has a password.
- Very specific: line 66
Add this to myapp/__init__.py:
- Distinctive: line 112
Run at least one worker in each live app setup.
- Distinctive: line 122
If the task depends on saved data, queue it after the database change is done:
- Distinctive: line 155
Run only one scheduler. Two schedulers may send the same task twice.
- Distinctive: line 212
Do not retry bad input.
- Distinctive: line 216
Keep failed tasks so they can be checked or run again.
- Distinctive: line 217
Use a dead-letter queue when the broker supports it.
- Distinctive: line 218
Do not log passwords, tokens, or private user data.
- Distinctive: line 224
Before sending money, email, or a web request, check if the work was already done.
- Distinctive: line 226
Keep tasks small. Pass file paths or record IDs instead of large files.
- Very specific: line 228
Do not wait for one task inside another task with .get().
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Django and Celery Tasks
Use Celery to run slow Django work outside web requests.
Use This Skill When
- Send email in the background.
- Run slow jobs.
- call an API without making the user wait.
- Run jobs at set times.
- Split a large job into small jobs.
Do not use Celery for work that must finish before the page loads.
Setup
1. Install Celery
For Redis:
pip install celery redisFor RabbitMQ:
pip install celery2. Set the Broker
Add this to Django settings:
CELERY_BROKER_URL = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND = "redis://localhost:6379/1"
CELERY_TASK_TIME_LIMIT = 300
CELERY_TASK_SOFT_TIME_LIMIT = 270Keep the broker URL in an env file when it has a password.
3. Create the Celery App
Create myapp/celery.py:
import os
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
app = Celery("myapp")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()Add this to myapp/__init__.py:
from .celery import app as celery_app
__all__ = ("celery_app",)Change myapp to the name of your Django project.
4. Write a Task
Create emails/tasks.py:
from celery import shared_task
from django.core.mail import send_mail
@shared_task(
autoretry_for=(Exception,),
retry_backoff=True,
retry_jitter=True,
retry_kwargs={"max_retries": 5},
)
def send_welcome_email(user_id):
from django.contrib.auth import get_user_model
user = get_user_model().objects.get(pk=user_id)
send_mail(
subject="Welcome",
message="Thanks for joining.",
from_email=None,
recipient_list=[user.email],
)Pass IDs, text, numbers, lists, or maps to tasks. Do not pass Django model objects.
5. Start a Worker
celery -A myapp worker --loglevel=INFORun at least one worker in each live app setup.
Queue a Task
from emails.tasks import send_welcome_email
send_welcome_email.delay(user.id)If the task depends on saved data, queue it after the database change is done:
from django.db import transaction
transaction.on_commit(
lambda: send_welcome_email.delay(user.id)
)This keeps the worker from reading data before it is saved.
Run Tasks on a Schedule
Add this to myapp/celery.py:
from celery.schedules import crontab
app.conf.beat_schedule = {
"send-report-daily": {
"task": "reports.tasks.send_report",
"schedule": crontab(hour=9, minute=0),
},
}Start the scheduler:
celery -A myapp beat --loglevel=INFORun only one scheduler. Two schedulers may send the same task twice.
Set the time zone in Django settings:
TIME_ZONE = "America/Chicago"
USE_TZ = True
CELERY_TIMEZONE = TIME_ZONEConcrete Example
Queue an image resize after an upload is saved:
# photos/tasks.py
from celery import shared_task
@shared_task(bind=True, max_retries=3)
def resize_photo(self, photo_id):
from .models import Photo
try:
photo = Photo.objects.get(pk=photo_id)
photo.make_thumbnail()
except Photo.DoesNotExist:
return
except OSError as error:
raise self.retry(exc=error, countdown=30)# photos/views.py
from django.db import transaction
from django.shortcuts import redirect
from .forms import PhotoForm
from .tasks import resize_photo
def upload_photo(request):
form = PhotoForm(request.POST, request.FILES)
if form.is_valid():
photo = form.save()
transaction.on_commit(
lambda: resize_photo.delay(photo.id)
)
return redirect("photo-detail", pk=photo.id)The page can return at once. The worker resizes the photo later.
Error Rules
- Retry short network or broker errors.
- Do not retry bad input.
- Set a retry limit.
- Set a time limit for slow tasks.
- Log the task name and record ID.
- Keep failed tasks so they can be checked or run again.
- Use a dead-letter queue when the broker supports it.
- Do not log passwords, tokens, or private user data.
Safe Task Rules
A task may run more than once. Write it so a second run is safe.
Before sending money, email, or a web request, check if the work was already done. Use a unique key or a saved status when needed.
Keep tasks small. Pass file paths or record IDs instead of large files.
Do not wait for one task inside another task with .get(). Queue the next task instead.
Checks Before Release
- The broker is running.
- The worker can load Django settings.
- The task is found by Celery.
- Retries have a limit.
- Slow tasks have a time limit.
- Tasks are safe to run twice.
- Tasks are queued after database commit.
- Only one scheduler is running.
- Worker logs are saved.
- Failed jobs can be checked and run again.
- Workers stop in a safe way during release.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

