0

I got a Raspberry PI and use a camera to capture pictures. The capture is triggered with a switch on a GPIO port.

The web site (flask; on 127.0.0.1) should show when I trigger the switch and since the saving of the picture takes a while, should also show a wait/ready information.

@app.route("/")
def index():

show a green button on the web, check the GPIO for switches create my template and

render_template('index.html', **templateData)  # seems not to work

wait for the existence of the captured image file and create an updated template

return render_template('index.html', **templateData)
if __name__ == "__main__":
    app.run(host='0.0.0.0', port=80, debug=True)  

I cannot figure out how I can update the web site twice, while I am waiting for the stored file.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Ronald Wiplinger
  • 2,033
  • 3
  • 14
  • 20

1 Answers1

0

A simple method would be to use the following tag in your template

<head>
 <meta http-equiv="refresh" content="30">
</head>

Some more info here https://en.wikipedia.org/wiki/Meta_refresh

This simply has the page do a refresh every 30secs.

al76
  • 754
  • 6
  • 13
  • That doesn't help. I need a green dot (Ready) before the button is pressed and a red one as soon it is pressed, TILL THE PICTURE IS SAVED (that takes about 6 seconds. Maybe I use two pages, one with green dot (Ready), when pressed goes to another page which shows red (wait), ... but even there, how do I switch to green again? – Ronald Wiplinger Jun 17 '19 at 04:17