python實(shí)現(xiàn)圖書(shū)借閱系統(tǒng)
本文實(shí)例為大家分享了python實(shí)現(xiàn)圖書(shū)借閱系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
部分代碼:
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'
# 首頁(yè)-->登錄頁(yè)面
@app.route('/')
def hello_world():
return render_template('login.html')
# 注冊(cè)頁(yè)面
@app.route('/showregister')
def showregister():
return render_template('register.html')
# 登錄頁(yè)面提交信息
@app.route('/login',methods=['GET','POST'])
def login():
username = request.form.get('username')
stuid = request.form.get('password') # 學(xué)號(hào)為密碼
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')
# 注冊(cè)頁(yè)面提交信息
@app.route('/register',methods=['GET','POST'])
def register():
username = request.form.get('username')
stuid = request.form.get('password')# 學(xué)號(hào)為密碼
return createdb.insert(stuid,username)
# 顯示書(shū)籍信息頁(yè)面
@app.route('/ShowBook')
def ShowBook():
return createdb.queryAllBook()
# 顯示添加書(shū)籍頁(yè)面
@app.route('/AddBook')
def AddBook():
return render_template('AddBook.html')
# 添加書(shū)籍信息
@app.route('/Add',methods=['GET','POST'])
def Add():
bookName = request.form.get('bookname')
bookAuthor = request.form.get('author')
return createdb.addBook(bookName,bookAuthor)
# 顯示借閱書(shū)籍信息
@app.route('/BorrowBook')
def BorrowBook():
return createdb.queryBorrowBook()
# 顯示借閱書(shū)籍信息
@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)
# 顯示借閱書(shū)籍信息
@app.route('/ReturnBook',methods=['GET','POST'])
def ReturnBook():
bookName = request.form.get("bookName")
return createdb.ReturnBook(bookName)
# 顯示借閱書(shū)籍信息
@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實(shí)現(xiàn)圖書(shū)借閱系統(tǒng)
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Python連接Mysql實(shí)現(xiàn)圖書(shū)借閱系統(tǒng)
- Python實(shí)現(xiàn)圖書(shū)借閱管理系統(tǒng)
- python圖書(shū)管理系統(tǒng)
- python實(shí)現(xiàn)圖書(shū)管理系統(tǒng)
- 基于python圖書(shū)館管理系統(tǒng)設(shè)計(jì)實(shí)例詳解
- python實(shí)現(xiàn)簡(jiǎn)單圖書(shū)管理系統(tǒng)
- python代碼實(shí)現(xiàn)圖書(shū)管理系統(tǒng)
- wxpython實(shí)現(xiàn)圖書(shū)管理系統(tǒng)
- Python簡(jiǎn)易版圖書(shū)管理系統(tǒng)
- python實(shí)現(xiàn)圖書(shū)館借閱系統(tǒng)
相關(guān)文章
python超簡(jiǎn)單解決約瑟夫環(huán)問(wèn)題
這篇文章主要介紹了python超簡(jiǎn)單解決約瑟夫環(huán)問(wèn)題的方法,詳細(xì)描述的約瑟夫環(huán)問(wèn)題的描述與Python解決方法,需要的朋友可以參考下2015-05-05
python用reduce和map把字符串轉(zhuǎn)為數(shù)字的方法
最近在復(fù)習(xí)高階函數(shù)的時(shí)候,有一道題想了半天解不出來(lái)。于是上午搜索資料,看了下別人的解法,發(fā)現(xiàn)學(xué)習(xí)編程,思維真的很重要。下面這篇文章就來(lái)給大家介紹了python利用reduce和map把字符串轉(zhuǎn)為數(shù)字的思路及方法,有需要的朋友們可以參考借鑒,下面來(lái)一起看看吧。2016-12-12
Python configparser模塊操作代碼實(shí)例
這篇文章主要介紹了Python configparser模塊操作代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-06-06
Python開(kāi)發(fā)之迭代器&生成器的實(shí)戰(zhàn)案例分享
在 Python 中,迭代器和生成器都是用來(lái)遍歷數(shù)據(jù)集合的工具,可以按需逐個(gè)生成或返回?cái)?shù)據(jù),從而避免一次性加載整個(gè)數(shù)據(jù)集合所帶來(lái)的性能問(wèn)題和內(nèi)存消耗問(wèn)題。本文主要和大家分享幾個(gè)貼近實(shí)際運(yùn)維開(kāi)發(fā)工作中的場(chǎng)景案例,希望對(duì)大家有所幫助2023-04-04
使用python+poco+夜神模擬器進(jìn)行自動(dòng)化測(cè)試實(shí)例
這篇文章主要介紹了使用python+poco+夜神模擬器進(jìn)行自動(dòng)化測(cè)試實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-04-04

