Describe the integration of Django with asynchronous task queues.
Instruction: Explain how to integrate Django with an asynchronous task queue (such as Celery) for background job processing.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Celery runs tasks outside the request process using workers and a broker. It is useful for operations such as generating an export or sending a notification, but moving work to a queue does not make it reliably delivered or harmless to repeat.
For a Django project, create the Celery application in the project package, set the Django settings module, load namespaced settings and autodiscover tasks from installed apps. Import the application during project initialization and define reusable tasks with shared_task. Configure the broker separately from an optional result backend; a backend is needed only when the chosen result workflow requires one...