from flask import Flask, render_template, request import sqlite3, os app = Flask(__name__) #get the current path name our app dir_path = os.path.dirname(os.path.realpath(__file__)) #create and connect to the database in our current folder conn = sqlite3.connect(dir_path+'/tealearn_grades.db', check_same_thread=False) @app.route('/') def index(): return render_template('index.html') @app.route('/student') def student(): return render_template('student.html') @app.route('/addstudent', methods=['GET', 'POST']) def addstudent(): if request.method == 'POST': surname = request.form['surname'] othernames = request.form['othernames'] address = request.form['address'] conn.execute('INSERT INTO student (surname_name,other_name,address_address) VALUES (?,?,?)',(surname, othernames, address)) conn.commit() output="Student record saved" return render_template('student.html', msg=output) #other code continue here... #@app.route('/dbsetup') #def dbsetup(): # sql_create_student_table.... if __name__ == '__main__': app.run(debug=True)
Students Record School Grading System
Students | Subjects | Instructor | Score Sheet
Setup Student Record
Back to home
{% if msg %}{{ msg }}
{% endif %}
School Grading System School Grading System
Students | Subjects | Instructor | Score SheetWelcome to my web app
No Comment yet!