RealOrangeOne / django-tasks

A reference implementation and backport of background workers and tasks in Django
https://pypi.org/project/django-tasks/
BSD 3-Clause "New" or "Revised" License
314 stars 22 forks source link

Use Django implementation when it's available #20

Open RealOrangeOne opened 4 months ago

RealOrangeOne commented 4 months ago

django-tasks and django.tasks should be able to exist at the same time in a given project. However, a task defined with django-tasks.task should be usable with a connection and backend from django.tasks (and vice versa).

I believe all of the use cases should pull from the connection, and thus the backend, however this will need verifying. If needs-be, we can stub out the internal connection to use the one from django.tasks if it exists, however this may cause issues if there's an explicit need to use django-tasks.

jribbens commented 3 months ago

I don't know if it's unutterably evil, but you could always make it so django-tasks monkey-patches itself into django.tasks, so you just do import django_tasks in settings.py and in all actual code you then always use django.tasks regardless of whether you're using an existing version of Django or a future version that has tasks built-in.