django-background-tasks icon indicating copy to clipboard operation
django-background-tasks copied to clipboard

Tasks aren't run from code that hasn't already been imported

Open alantrick opened this issue 5 years ago • 1 comments

I ran into this issue with using django_vox in a project. Django Vox has optional support for using background_task so that you can delay message sending. There was an API update though, and now I'm running into this issue.

As far as I can tell, the problem is that function that's decorated with background_task.background needs to be imported before process_tasks will pick it up. Because the default design with Django Vox is to lazy-load this function, it doesn't get picked up in our cron job that runs process_tasks.

alantrick avatar Jul 11 '19 04:07 alantrick

I have the same problem. I just import the files containing the tasks in my models.py file. It works, but it is not really beautiful. And it should be noticed in the docs.

Schwankenson avatar Oct 14 '20 12:10 Schwankenson