I am trying to display all images from a particular directory in static (static/plots). Here is my python:
hists = os.listdir('static/plots') hists = ['plots/' + file for file in hists] return render_template('report.html', hists = hists) and my html:
<!DOCTYPE=html> <html> <head> <title> Store Report </title> </head> <body> {{first_event}} to {{second_event}} {% for hist in hists %} <img src="{{url_for('static', filename='{{hist}}')}}" alt="{{hist}}"> {% endfor %} </body> </html>` And when the template successfully renders, the templates are not fetched. Opening the image in a new tab yields: http://127.0.0.1:8080/static/%7B%7Bhist%7D%7D
I imagine the problem is with this line, but I can't figure out what's correct:
<img src="{{url_for('static', filename='{{hist}}')}}" alt="{{hist}}">