Django Celery

by affaan-mef648e01899bNo license275K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 3 days ago

DjangoおよびCeleryを使用した非同期タスク処理。タスクキューイング、ワーカー管理、エラー処理、スケジューリング。Redis/RabbitMQ ブローカー統合。

Instructions onlySoftware Development
AI-generated overview

Guides Django developers in setting up Celery for background tasks, scheduling, and error handling.

What it does
This skill provides instructions for adding asynchronous background job processing to a Django application using Celery. It covers installing Celery with Redis, defining shared tasks, starting workers, scheduling recurring jobs with crontab, and handling errors through retries, dead-letter processing, logging, and Flower monitoring. It produces guidance and code snippets rather than runnable scripts.
When to use it
Use it when you need to run email sending or other heavy work in the background, schedule periodic tasks such as daily reports or cleanup, queue external API calls, or coordinate complex workflows in a Django project.
Requirements
Requires a Django project with Celery and Redis (or RabbitMQ) installed, plus a running broker and worker process. The skill ships no scripts; it is instructions only.

Django + Celery 非同期タスク

Django でのバックグラウンドジョブと非同期処理。

使用時期

  • メール送信をバックグラウンドで実行
  • 重い処理をスケジュール
  • 定期的なタスクを実行(日報、クリーンアップ)
  • 外部API呼び出しをキューイング
  • 複雑なワークフローを調整

セットアップ

1. Celery インストール

bash
pip install celery redis

2. タスク定義

python
from celery import shared_task
@shared_taskdef send_email(recipient):    # メール送信ロジック    pass

3. ワーカー起動

bash
celery -A myapp worker -l info

タスク

非同期実行

python
send_email.delay(recipient)  # すぐにキューに追加、非同期実行

スケジューリング

python
from celery.schedules import crontab
app.conf.beat_schedule = {    'send-report-daily': {        'task': 'app.tasks.send_report',        'schedule': crontab(hour=9, minute=0),    },}

エラーハンドリング

  • リトライロジック実装
  • デッドレター処理
  • ロギング構成
  • モニタリング設定(Flower)

詳細については、ドキュメントを参照してください。

Source and attribution

Source:affaan-m/eccindocs/ja-JP/skills/django-celeryat commitef648e0

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal

Django Celery Agent Skill | SourceWeft