-4

I'm trying to set up a webpage using Flask so I can pass Python variables to the HTML page. I created a test Python file with a page.html file inside a templates folder. I used the render_template function and passed it a variable number to be displayed on the page by referencing it in the html file (using {{number}} inside <p> tags). Instead of displaying the value of the variable, it displays the text {{number}}. I've seen other people online do the exact same thing and it works, does anyone know why it doesn't for me? I'm using VS code and Python 3.13.9.

Images attached of all of the above.

Image of my python file

Image of my html file

Image of the webpage when I run the python project

The python interpreter I'm using

New contributor
Ben_Maybe is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • 1
    hi, please, follow guidelines in minimal reproducible example, edit your post to align with those. thks Commented 2 days ago
  • Since this is a Flask project, we need to see your directory structure as well. Something like the tree command should give you the kind of text you need. Commented 2 days ago
  • Please do not upload images of code/data/errors. Commented yesterday

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.