Picamera2 in python flask web app? #64
-
Hi, I have just started using the picamera2 library and I would like to use it in my python flask web app. I am not sure how this would be possible, if at all. All I want to do is capture an image using the Picamera2() object and display it in an html template. This does not seem to work for me as the flask app "freezes" while the Picamera2 is initializing. This is my example code:
After loading the home page of the app I see this in the terminal:
But I never see the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Update: I have found a way to simulate the mjpeg_server.py in a flask app environment and it works! I just have to call picam2.stop_recording() every time I go to a different URL and then restart the picam2. |
Beta Was this translation helpful? Give feedback.
-
I just did something that could be useful for your use case. I decoupled the image capturing from the flask presentation. |
Beta Was this translation helpful? Give feedback.
Update: I have found a way to simulate the mjpeg_server.py in a flask app environment and it works! I just have to call picam2.stop_recording() every time I go to a different URL and then restart the picam2.