So I am working on a project and I want to render images I have stored inside my MySQL database. I created the tables using MySQLAlchemy and I am basically doing everything related to the db with that. Here is my code:
class Post1(db.Model):
id = db.Column(db.Integer, primary_key=True)
title=db.Column(db.String(120), nullable=False)
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
img = db.Column(db.BLOB(800000), nullable=False)
mimetype = db.Column(db.String(10))
@app.route('/read')
def read():
img = Post1.query.filter_by(id=Post1.id).first()
return render_template('readmanga.html', img=img.img)
<html>
<head>
</head>
<body>
<div><img src="" alt="" class="page"></div>
</body>
</html>
So here is what I want to do. I want to be able to render the image I stored in the img column in the Post1 class in the tag with the class="page" in the given template. I have absolutely no clue how to do this so please help me.