I am making a Django app. it needs to do background work (interacting with outside APIs) while the server is running, so it looks to me like I need to start a separate thread independent from all outside requests. What is the best way to go about this?
my first instinct was to simply import threading and start another thread, but where would I place that code in the Django app? is that even the right approach? do I need to make an outside service script that communicates with the app?
my googling has only lead me to things like django-background-tasks and celery, though from my understanding those solutions are only for tasks in views that take a long time, for returning the webpage before the task is actually done. do these solutions have support for background threads? I'm not looking for running a function every x amount of time, I want it to run forever from the moment Django starts.
I want it to be preferably self-contained inside the app, so a solution without an outside service script would be ideal. I want the app to be installable via pip.