1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Unable to pass variables to html using Flask (python)

Discussão em 'Python' iniciado por Stack, Novembro 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to set up a webpage using flask so that 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 the python 3.13.9 interpreter (installed from microsoft store).

    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

    Continue reading...

Compartilhe esta Página