<img src="https://openweathermap.org/img/wn/[email protected]">
The src url changes dynamically by changing the last part for example, by changing [email protected] to [email protected] a different icon can be obtained. However, I want to dynamically change the url in html using Jinja2 and flask
I tried using
img src="https://openweathermap.org/img/wn/{{icon}}@2x.png"
and send the icon variable from server side, but it won't work
When you use
render_templatein your code, do something like that:In your template:
Note the double-curly braces to render the variable. See the documentation