So, I wanted to upload an image in my website(HTML). The box does show up when I run the code but it does not show the image, instead it shows the image name. This is the code I used: app = Flask(name)
<img src="{{ url_for('static', filename='image.jpg') }}" alt="image.jpg" width=208 length=284>
I did try putting my image and code in the directory : /html/static
I even tried a code as simple as this but it didn't work:
from flask import Flask
app = Flask(__name__)
@app.route('/new')
def new_file():
return """
<html>
<head>
</head>
<body>
<p>
This is an image.
<img src="{{ url_for('static', filename='image.jpg') }}" alt="image.jpg" width=208 length=284>
</p>
</body>
</html>"""
if __name__=='__main__':
app.run(host='0.0.0.0', debug=True)