代码附上
# coding:utf-8
# 从同一个位置导入多个工具,
# python是后端
# 这些工具之间可以用逗号隔开,同时导入
# render_template渲染母版
from flask import Flask,render_template,request
app=Flask(__name__)
# 装饰器,路由用来封装链接,同时返回数据
@app.route('/index')
def index_xxx():
# 导入html
# 需要在桌面建立一个templates文件夹,
# 将html放到这个文件夹
return render_template('home2.html')
# 在函数中只要导入return,return后面的代码就不执行了
# return 'python!!'
@app.route('/login')
def login():
# 导入html
return render_template('home1.html')
# 在函数中只要导入return,return后面的代码就
1 在python编写简单的html登陆页面(2)的基础上在延伸一下:
可以将静态分配数据,建立表格,存放学生信息

2 加载到静态数据

3 html的编写直接在表格里添加一组数据就行了

4 VS Code上面跟前面的后台类似,添加一个content再链接到html就可以了
@app.route('/content')
def content():
return render_template('content.html')
return 'content.....'