建立py文件app
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/test')
def test():
name = 'Tom'
gender = 'male'
age = 23
return render_template('test.html',name = name, gender = gender, age =age)
if __name__=='__main__':
app.debug = True
app.run()
在相同的目录里创建文件夹static和templates,flask会自动调用
static里面放前端格式css文件
tenplates里面放html要实现的文件
test.html
```python
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>测试页面</title>
</head>
<body>
<p>
<h3>用户信息</h3>
姓名:<strong>{
{
name }}</strong>
<br>
性别:<span style="color:red;">{
{
gender }}</span>
<br>
年龄:{
{
age }}
</p>
</body>
</html>
就ok啦