Flask rendering template

Flask rendering template

Insert picture description here

Remember to put your html file into the newly created templates, as shown in the figure, so that jinjia2 can recognize it and open it locally.

Insert picture description here

from flask import render_template
from flask import Flask
import os
#os.chdir(r'C:\Users\LX\Desktop')
app = Flask(__name__)
FLASK_DEBUG=1
@app.route('/')
#@app.route('/hello/<name>')

def hello(name=None):
    return render_template('123.html', name=name)

Guess you like

Origin blog.csdn.net/XRTONY/article/details/114818489