這篇文章將為大家詳細講解有關(guān)python如何實現(xiàn)圖書借閱系統(tǒng),小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
成都創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務領(lǐng)域包括:成都做網(wǎng)站、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務,滿足客戶于互聯(lián)網(wǎng)時代的鯉城網(wǎng)站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡建設合作伙伴!部分代碼:
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)
關(guān)于“python如何實現(xiàn)圖書借閱系統(tǒng)”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網(wǎng)站題目:python如何實現(xiàn)圖書借閱系統(tǒng)-創(chuàng)新互聯(lián)
文章地址:http://bm7419.com/article10/ddpcdo.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、網(wǎng)站營銷、企業(yè)網(wǎng)站制作、品牌網(wǎng)站建設、動態(tài)網(wǎng)站、微信公眾號
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)