0

enter image description here

I am trying to display svg images on a website built with flask but unfortunately only the above icons show up. I have found similar questions on here but no answer that seems to fit my problem. My html code is the following:

<html>
    <body>
        {% for name, name2 in zipp %}
        <img src="{{ url_for('static', filename = 'data:image/svg+xml' + name) }}" ></img>
        <p>{{ name2 }}</p>
        {% endfor %}
    </body>
</html>

While my flask app looks like this:

app = Flask(__name__)
b = os.getcwd()
listo2 = []
@app.route("/")
def home():
    for file in os.listdir(b):
        if file.endswith(".svg"):
            listo2.append(file)
    zipp = zip(listo2, listo2)
    return render_template("templates.html", zipp = zipp)
if __name__ == "__main__":
    app.run()
1337_N00B
  • 47
  • 8

0 Answers0