python实现图书借阅系统
作者:晚风润的侯侯 时间:2022-03-26 07:46:32
本文实例为大家分享了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['stuid'] = stuid
return render_template('index.html', stuid=stuid, username=username)
else:
return render_template('login.html')
# 注册页面提交信息
@app.route('/register',methods=['GET','POST'])
def register():
username = request.form.get('username')
stuid = request.form.get('password')# 学号为密码
return createdb.insert(stuid,username)
# 显示书籍信息页面
@app.route('/ShowBook')
def ShowBook():
return createdb.queryAllBook()
# 显示添加书籍页面
@app.route('/AddBook')
def AddBook():
return render_template('AddBook.html')
# 添加书籍信息
@app.route('/Add',methods=['GET','POST'])
def Add():
bookName = request.form.get('bookname')
bookAuthor = request.form.get('author')
return createdb.addBook(bookName,bookAuthor)
# 显示借阅书籍信息
@app.route('/BorrowBook')
def BorrowBook():
return createdb.queryBorrowBook()
# 显示借阅书籍信息
@app.route('/Borrow',methods=['GET','POSt'])
def Borrow():
bookName = request.form.get('bookName')
bookAuthor = request.form.get('bookAuthor')
username = session.get('username')
stuid = session.get('stuid')
return createdb.Borrow(username,stuid,bookName,bookAuthor)
# 显示借阅书籍信息
@app.route('/ReturnBook',methods=['GET','POST'])
def ReturnBook():
bookName = request.form.get("bookName")
return createdb.ReturnBook(bookName)
# 显示借阅书籍信息
@app.route('/UserInfo')
def UserInfo():
stuid = session.get('stuid')
username = session.get('username')
return render_template('userInfo.html',stuid = stuid,username = username)
if __name__ == '__main__':
app.run(debug=True)
源码下载:python实现图书借阅系统
标签:python,借阅系统
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
网站程序员如何应对web标准
2007-05-11 16:52:00
![](https://img.aspxhome.com/file/uploadpic/20075/2007511165222957.gif)
asp 横排显示数据
2011-03-10 10:50:00
pycharm激活码快速激活及使用步骤
2022-05-09 01:31:29
python selenium自动化测试框架搭建的方法步骤
2023-05-24 21:38:49
![](https://img.aspxhome.com/file/2023/9/75899_0s.jpg)
Python实现矩阵加法和乘法的方法分析
2023-07-30 09:39:06
基于python的selenium两种文件上传操作实现详解
2022-01-31 23:02:17
![](https://img.aspxhome.com/file/2023/6/97666_0s.png)
10个有用的Python字符串函数小结
2023-08-13 11:26:28
轻松搞定IE的CSS制作网页技巧3则
2009-08-14 20:32:00
HTTP中header头部信息详解
2023-06-11 23:33:17
谈中国站长站的文章干扰码实现方法
2007-10-13 11:13:00
![](https://img.aspxhome.com/file/UploadPic/up/2007101313560193.jpg)
PHP header()函数常用方法总结
2023-09-06 16:51:50
详解Python如何实现对比两个Excel数据差异
2023-06-14 00:37:10
![](https://img.aspxhome.com/file/2023/5/104895_0s.png)
用VB将ASP代码封装成DLL
2007-09-28 12:46:00
ASP利用TCPIP.DNS组件实现域名IP查询
2010-02-26 11:25:00
python反反爬虫技术限制连续请求时间处理
2023-08-27 13:53:04
![](https://img.aspxhome.com/file/2023/2/62542_0s.jpg)
python实现用户名密码校验
2022-12-14 07:48:33
![](https://img.aspxhome.com/file/2023/4/70684_0s.jpg)
python opencv 批量改变图片的尺寸大小的方法
2021-09-13 12:55:01
![](https://img.aspxhome.com/file/2023/2/107212_0s.jpg)
非集成环境的php运行环境(Apache配置、Mysql)搭建安装图文教程
2023-07-21 16:21:41
![](https://img.aspxhome.com/file/2023/0/5707955470_0s.png)
python interpolate插值实例
2022-05-06 08:20:37
![](https://img.aspxhome.com/file/2023/4/84874_0s.jpg)
Mysql使用Describe命令判断字段是否存在
2011-04-25 18:27:00