vendredi 22 mai 2020

why python variable does not shown in html correctly? [closed]

im using flask framework. this is my html code:

<html>
<head></head>
<body>
    <h1>Hello! </h1>
</body>
</html>

that exists one variable on it from python. but in browser does not shown its containing. and show like this :

Hello !

my python code is:

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def index():
    name = "Shafi"
    return render_template('basic.html',name=name)

if __name__ == '__main__':
    app.run(debug=True)

I installed libraries and im using pycharm. you know pycharm creates flask environment automatically and no need to create manually. but does not work in browser. what can i do?




Aucun commentaire:

Enregistrer un commentaire