Pass Variable From Python (flask) To HTML In Render Template?
The web server works (python flask) but when I go to the website, where the value of animal should be (dog) it shows the variable name animal. (There is more to the code but this i
Solution 1:
Shouldn't it be animal = 'dog'
? If 'dog' is the value you want to see printed after "I like the animal:", this is what you need to do:
animal = 'dog'
return render_template('index.html', value=animal)
Solution 2:
As you have to pass a value using a variable you have to define it as a string like:
animal = 'dog'
then pass it to the html template:
return render_template('index.html', value=animal)
Now, you should see the passed value in the HTML.
Post a Comment for "Pass Variable From Python (flask) To HTML In Render Template?"