By default, Celery routes all your tasks to the default queue named celery . This is good enough for small apps that have less than 10 (or less) different task functions.

Personally I like to have each Django “app” and its tasks have a dedicated queue. This makes it easy to adjust the workers for each app without affecting others.

For example, let’s say we have an app called customers with the following structure:

+ project/ |- core/ | |- models.py | |- tasks.py | `- views.py |- customers/ | |- models.py | |- views.py | `- tasks.py |- settings.py |- celery_config.py `- manage.py

And we want all customers tasks to be processed by a dedicated worker (could be running on a separate machine), and have all other tasks (e.g. core tasks) to be processed by a lower frequency/priority worker.

We’ll need a router for the customers app. Create a new file customers/routers.py :

# customers/routers.py class CeleryTaskRouter ( object ): def route_for_task ( self , task, args= None , kwargs= None ): if task.startswith( 'customers.' ): return 'customers' return None

And specify our routers in settings.py :

CELERY_ROUTES = ( 'customers.routers.CeleryTaskRouter' , )

You can have as many routers as you want, or one main router with a bunch of if statements.

Now, all tasks defined in the "customers.tasks" module will be routed to a queue named "customers" , this is because Celery task names are derived from their module name and function name (if you don’t specify the name parameter in @app.task ).

If we start a worker like so:

$ ./manage.py celery worker --app=celery_config:app --queue=customers -n "customers.%%h"

The worker will have a name "customers.hostname" and will only process tasks defined in the customers.tasks module.

Any other tasks (e.g. those defined in core.tasks ) will be ignored, unless we start a separate worker process to process tasks going to the “default” queue (named "celery" by default).

$ ./manage.py celery worker --app=celery_config:app --queue=celery

This decouples our apps’ workers and makes monitoring and managing them easier.