本文实例为大家分享了python实现图书借阅系统的具体代码,供大家参考,具体内容如下
部分代码:
from flask import Flask,render_template
from flask import request
from DB import createdb
from flask import session
app = Flask(__name__)
app.config["SECRET_KEY"] = "123456"
# 首页-->登录页面
@app.route("/")
def hello_world():
return render_template("login.html")
# 注册页面
@app.route("/showregister")
def showregister():
return render_template("register.html")
# 登录页面提交信息
@app.route("/login",methods=["GET","POST"])
def login():
username = request.form.get("username")
stuid = request.form.get("password") # 学号为密码
flag = createdb.selectStu(stuid,username)
if flag:
session["username"] = username
session[