Alon Swartz - Wed, 2010/02/24 - 08:15 -
Or, Celery + RabbitMQ = Django awesomeness!
As you know, Django is synchronous, or blocking. This means each request will not be returned until all processing (e.g., of a view) is complete. It's the expected behavior and usually required in web applications, but there are times when you need tasks to run in the background (immediately, deferred, or periodically) without blocking.
Some common use cases:
-
Give the impression of a really snappy web application by finishing a request as soon as possible, even though a task is running in the background, then update the page incrementally using AJAX.
-
Executing tasks asynchronously and using retries to make sure they are completed successfully.
-
Scheduling periodic tasks.
-
Parallel execution (to some degree).