jeudi 3 juin 2021

Flask access json data and embedding it in a tag

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= 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'>
        
</div>

I can see the url value as text in my webpage




Aucun commentaire:

Enregistrer un commentaire