OpenCV with Flask or Django

Hello guys,
I want to know how to render a frame on the website using Flask or Django,
because I want to add event listeners on a frame with OpenCV waitkey and setmousecallback but using Flask or Django
if someone can help me with that, the only thing I can do at the moment is to convert the matrix image to an actual image.jpeg and render it on the web, if someone can help me please on this

think of it, you cannot use opencv’s gui (imshow, event handlers,waitKey, etc) on a webserver, you have to write your own UI in html/js

Thank you for your comment, can you recommend a solution for this? if I don’t want to make a server request each time an event exist?
you think using react node, and implementing opencv.js is better?