mesand
Posts: 65
Joined: Tue Oct 22, 2019 9:21 pm

Post Image to Flask Webserver

Sat Nov 16, 2019 11:07 pm

Hi all,

I have sensors taking in data on my pi being saved to an sqlite3 database. I also have a flask webserver running on it. I would like to display images of historical data on the webserver and really cant find anything helpful. Below is what I am using for code and html.

app = Flask(__name__)

@app.route("/")
def index():
return render_template('live_stream.html')

if __name__ == "__main__":
app.run(host='127.0.0.1', debug=True)



<html>
<head>
<title> Live Streaming</title>
body {
text-align: center;
}
</style>
</head>
<body>
<h1> Live Streaming</h1>
<img src="url_for('static', filename='image.png'), width="80%"></img>
<h3>{{ time }}</h3>
<hr>
<h3> Return to main page ==> <a href="/"class="button">RETURN</a></h3>
<hr>
</body>
</html>

User avatar
neilgl
Posts: 2185
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Post Image to Flask Webserver

Sun Nov 17, 2019 7:20 am

Some time ago I used rrdtool to generate graphs and show them on a web page as images. Now I use grafana.

Return to “General discussion”