0

I have the following flask route

@app.route("/rec_demo")
def rec_demo():
    print("de lokos")
    response_data = {"rec_one": "pic_trulli.jpg"}

    return render_template("demografico.html", data=response_data)

And I try to access the rec_one to display it as an image

<div id='info_section'>
        <img src={{ data.rec_one }} alt="Girl in a jacket" width="500" height="600">
</div>

But when I check the web on a live server the src doesn't resolve to the url I passed. If instead I had

<div id='info_section'>
        {{ data.rec_one }}
</div>

I can see the url value as text in my webpage

eljiwo
  • 687
  • 1
  • 8
  • 29

1 Answers1

0

You should be putting quotes around your flask call -- IE

<img src="{{ data.rec_one }}" alt="Girl in a jacket" width="500" height="600">

This will cause problems not only with the flask output .. But the browser's interpretation as well.

Zak
  • 6,976
  • 2
  • 26
  • 48