[Answer]-Run code after rendering django

1👍

The process that updates the image must be run asynchronously, independent from your Django views. Your Django view can just return the latest image and return, perhaps start up the asynchronous task if it’s not running yet.

It’s common to use Celery for this.

0👍

It can’t be done that way. HTTP just doesn’t work that way. Your Django view must return one snapshot at a time. On your front-end add javascript code to send request to Django for new snapshot. Of course 20times per second is too much. It looks like you need to stream your camera output to the browser, not create 20 snapshots per second with Django 😉

Leave a comment