Writing and Calling @shared_task
Run functions asynchronously with delay().
Tasks Are Just Functions
A Celery task is an ordinary Python function with a decorator on top. The decorator teaches Celery how to queue and run it later.
Why shared_task
Use @shared_task instead of @app.task so your tasks do not depend on a specific Celery app. It is the standard choice inside Django apps.
All lessons in this course
- Why You Need Background Tasks
- Setting Up Celery with a Broker
- Writing and Calling @shared_task
- Scheduled Jobs with Celery Beat