0

I'm kind of new to HTML code, I would like to show some images that my Python code has selected and this is what I came up with. application.py

s = f"""
    <img src="{{url_for('static', filename='{file1}')}}" />
    <img src="{{url_for('static', filename='{file2}')}}" />
    """
    return render_template("index.html", s = s)

file1 and file2 being jpg image file names

index.html

<p>
   {{ s|e }}
</p>

This code is just writing the html tags that I made, not displaying an image. Please let me know what I'm doing wrong.

Spylee01
  • 3
  • 2
  • 1
    Would you not need to quote the filename parameter, e.g. `filename='%s'`? What is `url_for`? What web framework are you using? Edit the question. See [ask] and how to create a [mcve]. – Peter Wood Dec 21 '19 at 22:02
  • sounds like a task for [Jinja](https://jinja.palletsprojects.com/en/2.10.x/) – gold_cy Dec 21 '19 at 22:08
  • Made some edits to the code in the question, still no luck. Any ideas? – Spylee01 Dec 22 '19 at 19:01

0 Answers0