How to run an application automatically and in the background in Django?

Good day.

I have an application that displays on a page a stream from a video camera on which detections are indicated. I need to count them for further statistics.

The problem is that all the script logic only works if I open a specific page. That is, I opened the “Camera1” page, saw the video stream from it and the script detects and counts the objects in the frame. If I open “Camera2” - the same. I need these scripts to work even when the page is not open.

That is, for example, after rebooting the server, the Django application is automatically launched and, as it were, the opening of all pages from the cameras is simulated so that the scripts start working.

In a word, I need the script to work even if it is not called directly on the page. Is this possible and if so - how? Thank you

You do not want to try managing processes like this from within Django. Run these as a separate process and create some type of IPC to make this data available to Django. (You can find other discussions here explaining why it’s a bad idea to try and do this within your Django code.)

Got you, thank you. I will try it in this variant