What is the best place or method to run tasks in Django that should happen in the background, not immediately on a web request?
Celery is the most common suggested solution, but any background task system will work.
1 Like
A couple of alternatives to Celery:
- GitHub - django-q2/django-q2: A multiprocessing distributed task queue for Django based on Django-Q
- GitHub - coleifer/huey: a little task queue for python
I’ve only used django-q2 and it was fine for my simple uses (running management commands periodically).
This is mostly just FYI, but there is an accepted DEP to add background tasks natively and a reference implementation called django-tasks. I don’t know offhand what the current status of that project is, or what the timeline for tasks being added to core is, but it might be something to look at if you want to know what the expected “official” answer will be eventually.
That said, for a project starting today, using celery or one of the alternatives that are already in use is probably a safer bet.
1 Like