国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

python Web開發(fā) flask輕量級Web框架實戰(zhàn)項目--學生管理系統(tǒng)

這篇具有很好參考價值的文章主要介紹了python Web開發(fā) flask輕量級Web框架實戰(zhàn)項目--學生管理系統(tǒng)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

?上次發(fā)的一篇文章,有很多朋友私信我要后面的部分,那咱們就今天來一起學習一下吧,因為我的數(shù)據(jù)庫這門課選中的課題是學生管理系統(tǒng),所以今天就以這個課題為例子,從0到1去實現(xiàn)一個管理系統(tǒng)。數(shù)據(jù)庫設(shè)計部分我會專門出一個博客的,敬請期待吧~~~


介如很多朋友問源碼,我已經(jīng)將它上傳到github上。(內(nèi)有sql文件,可直接導入數(shù)據(jù)庫使用)

看到這了點個贊再走吧

wuyongch/-Student-management-system: 該學生管理系統(tǒng)使用python+flask框架+mysql數(shù)據(jù)庫 實現(xiàn)學生錄入、學生信息修改、學生課程錄入和查詢、畢業(yè)學生去向查詢、教師開設(shè)課程查看、管理超級用戶 (github.com)

效果展現(xiàn)

flask web開發(fā)實戰(zhàn),python編程,flask,python,后端

一、實現(xiàn)登錄功能

這里我就不細講了,感興趣的可以看下面這個博客??

(5條消息) python Web開發(fā) flask輕量級Web框架實戰(zhàn)項目--實現(xiàn)功能--賬號密碼登錄界面(連接數(shù)據(jù)庫Mysql)_flask web開發(fā)實戰(zhàn)_吳永暢的博客-CSDN博客

這次有點不同的是 需要把登錄功能封裝成一個login函數(shù),然后我為了省事呢就把數(shù)據(jù)庫連接放在外部。

代碼實現(xiàn)(前端登錄界面在上方博客里)

# 初始化
app = flask.Flask(__name__)
# 使用pymysql.connect方法連接本地mysql數(shù)據(jù)庫
db = pymysql.connect(host='localhost', port=3306, user='root',
             password='root', database='student', charset='utf8')
# 操作數(shù)據(jù)庫,獲取db下的cursor對象
cursor = db.cursor()
# 存儲登陸用戶的名字用戶其它網(wǎng)頁的顯示
users = []

@app.route("/", methods=["GET", "POST"])
def login():
    # 增加會話保護機制(未登陸前l(fā)ogin的session值為空)
    flask.session['login'] = ''
    if flask.request.method == 'POST':
        user = flask.request.values.get("user", "")
        pwd = flask.request.values.get("pwd", "")
        # 防止sql注入,如:select * from admins where admin_name = '' or 1=1 -- and password='';
        # 利用正則表達式進行輸入判斷
        result_user = re.search(r"^[a-zA-Z]+$", user)  # 限制用戶名為全字母
        result_pwd = re.search(r"^[a-zA-Z\d]+$", pwd)  # 限制密碼為 字母和數(shù)字的組合
        if result_user != None and result_pwd != None:  # 驗證通過
            msg = '用戶名或密碼錯誤'
            # 正則驗證通過后與數(shù)據(jù)庫中數(shù)據(jù)進行比較
            # sql = "select * from sys_user where username='" + \
            #       user + "' and password='" + pwd + "';"
            sql1 = "select * from admins where admin_name='" + \
                user + " ' and admin_password='" + pwd + "';"
            # cursor.execute(sql)
            cursor.execute(sql1)
            result = cursor.fetchone()
            # 匹配得到結(jié)果即管理員數(shù)據(jù)庫中存在此管理員
            if result:
                # 登陸成功
                flask.session['login'] = 'OK'
                users.append(user)  # 存儲登陸成功的用戶名用于顯示
                return flask.redirect(flask.url_for('student'))
                # return flask.redirect('/file')
        else:  # 輸入驗證不通過
            msg = '非法輸入'
    else:
        msg = ''
        user = ''
    return flask.render_template('login.html', msg=msg, user=user)

二、學生信息錄入功能

?這里我們可以錄入的信息是學生學號、學生姓名、班級、性別等。

首先用戶登錄成功之后,跳轉(zhuǎn)到學生信息錄入界面,系統(tǒng)需要顯示出學生表信息。

    if flask.request.method == 'GET':
        sql_list = "select * from students_infos"
        cursor.execute(sql_list)
        results = cursor.fetchall()
    if flask.request.method == 'POST':
        # 獲取輸入的學生信息
        student_id = flask.request.values.get("student_id", "")
        student_class = flask.request.values.get("student_class", "")
        student_name = flask.request.values.get("student_name", "")
        student_sex = flask.request.values.get("student_sex")

        print(student_id, student_class, student_name, student_sex)

插入數(shù)據(jù)只需要寫入sql語句,并且執(zhí)行該語句就可以,異常處理是個人習慣,在插入失敗是系統(tǒng)給予提示,這里的sql語句都是寫活的,真正的數(shù)據(jù)是來源于頁面輸入,其實就是調(diào)用了sql語句插入成功后,學生表就會自動同步顯示在前端頁面上。

完整代碼如下

@app.route('/student', methods=['GET', "POST"])
def student():
    # login session值
    if flask.session.get("login", "") == '':
        # 用戶沒有登陸
        print('用戶還沒有登陸!即將重定向!')
        return flask.redirect('/')
    insert_result = ''
    # 當用戶登陸有存儲信息時顯示用戶名,否則為空
    if users:
        for user in users:
            user_info = user
    else:
        user_info = ''
    # 獲取顯示數(shù)據(jù)信息
    if flask.request.method == 'GET':
        sql_list = "select * from students_infos"
        cursor.execute(sql_list)
        results = cursor.fetchall()
    if flask.request.method == 'POST':
        # 獲取輸入的學生信息
        student_id = flask.request.values.get("student_id", "")
        student_class = flask.request.values.get("student_class", "")
        student_name = flask.request.values.get("student_name", "")
        student_sex = flask.request.values.get("student_sex")

        print(student_id, student_class, student_name, student_sex)

        try:
            # 信息存入數(shù)據(jù)庫
            sql = "create table if not exists students_infos(student_id varchar(10) primary key,student_class varchar(100),student_name varchar(32),student_sex VARCHAR(4));"
            cursor.execute(sql)
            sql_1 = "insert into students_infos(student_id, student_class, student_name, student_sex )values(%s,%s,%s,%s)"
            cursor.execute(sql_1, (student_id, student_class, student_name, student_sex))
            insert_result = "成功存入一條學生信息"
            print(insert_result)
        except Exception as err:
            print(err)
            insert_result = "學生信息插入失敗"
            print(insert_result)
            pass
        db.commit()
        # POST方法時顯示數(shù)據(jù)
        sql_list = "select * from students_infos"
        cursor.execute(sql_list)
        results = cursor.fetchall()
    return flask.render_template('student.html', insert_result=insert_result, user_info=user_info, results=results)

student前端頁面(需要自取,點個贊哦)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>學生成績管理系統(tǒng)</title>
    <link rel="icon" >
     <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.min.css"/>
    <style>
            .container {
            position: absolute;
            width: 100%;
            height: 100%;
    }
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 200px;
            background-color: #f1f1f1;
        }

        li a {
            display: block;
            color: #000;
            padding: 8px 16px;
            text-decoration: none;
        }

        li a.active {
            background-color: #4CAF50;
            color: white;
        }

        li a:hover:not(.active) {
            background-color: #555;
            color: white;
        }

        li {
            list-style: none;
        }

        a {
            text-decoration: none;
            color: white;
        }

        .header {
            position: relative;
            width: 100%;
            height: 55px;
            background-color: black;
        }

        .left {
            position: absolute;
            left: 20px;
            font-size: 20px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right {
            position: absolute;
            right: 160px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right_right {
            position: absolute;
            right: 24px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .leftside {
            float: left;
            background-color: rgb(245, 245, 245);
            /* height: 663px; */
            width: 230px;
        }

        .leftside ul {

            height: 663px;
        }

        .leftside .first {
            background-color: rgb(66, 139, 202);
            margin-top: 25px;

        }

        .leftside .first a {
            color: white;

        }

        .leftside {
            float: left;
            width: 200px;
            height: 100%;
        }

        .leftside ul li {

            border-bottom: 0.2px solid white;

            font-size: 20px;
            height: 60px;
            line-height: 60px;
            width: 100%;
            text-align: center;
        }




        .container-fluid {
            float: none;
            width: 100%;
            height: 100%;

        }

        /* .sub-header {
            margin-top: 5px;
        } */

        .table-responsive {

            margin-top: 10px;
        }

        .table-striped {

            width: 1250px;
        }

        thead tr th {
            background-color: white;
        }


    </style>
</head>

<body>
<div class="container">
    <div class="header">
        <span class="left">學 生 信 息 錄 入</span>
        <span class="right">你 好,{{user_info}}管 理 員!</span>
        <span class="right_right"><a href="/">退出登陸</a></span>
    </div>
    <div class="leftside">
        <ul>
            <li class="first"><a href="/student">學生信息錄入</a></li>
            <li><a href ="/updata_student">學生信息修改</a></li>
            <li><a href="/teacher_class">老師開設(shè)課程查看</a></li>
            <li><a href="/teacher">選課信息錄入</a></li>
            <li><a href="/grade">成績信息錄入</a></li>
            <li><a href="/grade_infos">學生成績查詢</a></li>
            <li><a href="/graduation">畢業(yè)去向</a></li>
            <li><a href="/adminstator">系統(tǒng)管理員變動</a></li>
        </ul>
    </div>
    <div class="container-fluid">
        <h1 class="sub-header">學 生 信 息 錄 入 系 統(tǒng)</h1>&nbsp;&nbsp;
        <hr>
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>學號</th>
                        <th>班級</th>
                        <th>姓名</th>
                        <th>性別</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <form action="" method="post">
                            <td><input class="long" name="student_id" type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                            <td><input class="long" name="student_class" type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td><input class="long" name="student_name"
                                    type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                             <td><input class="long" name="student_sex"
                                    type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td><input class="last" type="submit" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                            <td><span>提交結(jié)果:{{insert_result}}</span></td>
                        </form>
                    </tr>
                    <tr>
                        <td>學生學號</td>
                        <td>所屬班級</td>
                        <td>學生姓名</td>
                        <td>學生性別</td>
                    </tr>
                    {% for result in results %}
                    <tr>
                        <td>{{result[0]}}</td>
                        <td>{{result[1]}}</td>
                        <td>{{result[2]}}</td>
                        <td>{{result[3]}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>

        </div>
    </div>
</div>

</body>

</html>

三、學生信息變動功能(修改班級和姓名or刪除學生)

如圖所示 吳永暢現(xiàn)在的班級是軟件工程212 現(xiàn)在要修改為軟件工程213 那么就在下拉框里選擇修改學生班級,然后把學生學號和姓名填入,在學生班級那里填入修改后的班級。

flask web開發(fā)實戰(zhàn),python編程,flask,python,后端

?修改后:flask web開發(fā)實戰(zhàn),python編程,flask,python,后端

原理都是一樣的,執(zhí)行對應的sql語句即可,這里就不贅述了。?

?完整代碼

@app.route('/updata_student', methods=['GET', "POST"])
def updata_student():
    # login session值
    if flask.session.get("login", "") == '':
        # 用戶沒有登陸
        print('用戶還沒有登陸!即將重定向!')
        return flask.redirect('/')
    insert_result = ''
    # 獲取顯示學生數(shù)據(jù)信息(GET方法的時候顯示數(shù)據(jù))
    if flask.request.method == 'GET':
        sql_list = "select * from students_infos"
        cursor.execute(sql_list)
        results = cursor.fetchall()
    # 當用戶登陸有存儲信息時顯示用戶名,否則為空
    if users:
        for user in users:
            user_info = user
    else:
        user_info = ''
    if flask.request.method == 'POST':
        # 獲取輸入的學生信息
        student_id = flask.request.values.get("student_id", "")
        student_class = flask.request.values.get("student_class", "")
        student_name = flask.request.values.get("student_name", "")
        # student_sex = flask.request.values.get("student_sex", "")

        student_id_result = re.search(r"^\d{8,}$", student_id)  # 限制用戶名為全字母
        # 驗證通過
        if student_id_result != None:  # 驗證通過
            # 獲取下拉框的數(shù)據(jù)
            select = flask.request.form.get('selected_one')
            if select == '修改學生班級':
                try:
                    sql = "update students_infos set student_class=%s where student_id=%s;"
                    cursor.execute(sql, (student_class, student_id))
                    insert_result = "學生" + student_id + "的班級修改成功!"
                except Exception as err:
                    print(err)
                    insert_result = "修改學生班級失敗!"
                    pass
                db.commit()
            if select == '修改學生姓名':
                try:
                    sql = "update students_infos set student_name=%s where student_id=%s;"
                    cursor.execute(sql, (student_name, student_id))
                    insert_result = "學生" + student_name + "的姓名修改成功!"
                except Exception as err:
                    print(err)
                    insert_result = "修改學生姓名失敗!"
                    pass
                db.commit()

            if select == '刪除學生':
                try:
                    sql_delete = "delete from students_infos where student_id='" + student_id + "';"
                    cursor.execute(sql_delete)
                    insert_result = "成功刪除學生" + student_id
                except Exception as err:
                    print(err)
                    insert_result = "刪除失敗"
                    pass
                db.commit()

        else:  # 輸入驗證不通過
            insert_result = "輸入的格式不符合要求!"
        # POST方法時顯示數(shù)據(jù)
        sql_list = "select * from students_infos"
        cursor.execute(sql_list)
        results = cursor.fetchall()
    return flask.render_template('updata_student.html', user_info=user_info, insert_result=insert_result,
                                 results=results)

前端頁面?updata_student.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>學生成績管理系統(tǒng)</title>
    <link rel="icon" >
 <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.min.css"/>

        <style>
            .container {
            position: absolute;
            width: 100%;
            height: 100%;
    }
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 200px;
            background-color: #f1f1f1;
        }

        li a {
            display: block;
            color: #000;
            padding: 8px 16px;
            text-decoration: none;
        }

        li a.active {
            background-color: #4CAF50;
            color: white;
        }

        li a:hover:not(.active) {
            background-color: #555;
            color: white;
        }

        li {
            list-style: none;
        }

        a {
            text-decoration: none;
            color: white;
        }

        .header {
            position: relative;
            width: 100%;
            height: 55px;
            background-color: black;
        }

        .left {
            position: absolute;
            left: 20px;
            font-size: 20px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right {
            position: absolute;
            right: 160px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right_right {
            position: absolute;
            right: 24px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .leftside {
            float: left;
            background-color: rgb(245, 245, 245);
            /* height: 663px; */
            width: 230px;
        }

        .leftside ul {

            height: 663px;
        }

        .leftside .first {
            background-color: rgb(66, 139, 202);
            margin-top: 25px;

        }

        .leftside .first a {
            color: white;

        }

        .leftside {
            float: left;
            width: 200px;
            height: 100%;
        }

        .leftside ul li {

            border-bottom: 0.2px solid white;

            font-size: 20px;
            height: 60px;
            line-height: 60px;
            width: 100%;
            text-align: center;
        }


        .container-fluid {
            float: none;
            width: 100%;
            height: 100%;

        }
        .table-responsive {

            margin-top: 10px;
        }

        .table-striped {

            width: 1250px;
        }

        thead tr th {
            background-color: white;
        }

    </style>
</head>

<body>
<div class="container">
    <div class="header">
        <span class="left">學 生 信 息 修 改</span>
        <span class="right">你 好,{{user_info}}管 理 員!</span>
        <span class="right_right"><a href="/">退出登陸</a></span>
    </div>
    <div class="leftside">
        <ul>
            <li><a href="/student">學生信息錄入</a></li>
             <li class="first"><a href="#">學生信息變動</a></li>
            <li><a href="/teacher_class">老師開設(shè)課程查看</a></li>
            <li><a href="/teacher">選課信息錄入</a></li>
            <li><a href="/grade">成績信息錄入</a></li>
            <li><a href="/grade_infos">學生成績查詢</a></li>
            <li><a href="/graduation">畢業(yè)去向</a></li>
            <li><a href="/adminstator">系統(tǒng)管理員變動</a></li>
        </ul>
    </div>
    <div class="container-fluid">
        <h1 class="sub-header">學 生 信 息 修 改 系 統(tǒng)</h1>&nbsp;&nbsp;
        <hr>
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>學生學號<span>(限全數(shù)字的學號)</span></th>
                        <th>學生班級<span></span></th>
                        <th>學生姓名<span></span></th>
                        <th>學生性別<span></span></th>-->
                        <th>選擇(修改/刪除)學生</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <form action="" method="post">
                            <td><input class="long" name="student_id"
                                    type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td><input class="long" name="student_class" type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                            <td><input class="long" name="student_name"
                                    type="text" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td><select name="selected_one">
                                    <option value="修改學生班級">修改學生班級</option>
                                    <option value="修改學生姓名">修改學生姓名</option>
                                    <option value="刪除學生 ">刪除學生</option>
                                </select></td>
                            <td><input class="last" type="submit" value="操作" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                            <td class="doit"><span>操作結(jié)果:{{insert_result}}</span></td>
                        </form>
                    </tr>
                    <tr>
                        <td>學號</td>
                        <td>班級</td>
                        <td>姓名</td>

                    </tr>
                    {% for result in results %}
                    <tr>
                        <td>{{result[0]}}</td>
                        <td>{{result[1]}}</td>
                        <td>{{result[2]}}</td>


                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>

</div>


</body>

</html>

四、學生成績查詢功能

如下圖查詢學號為20212248的學生成績

flask web開發(fā)實戰(zhàn),python編程,flask,python,后端

?這里我們設(shè)計幾種常見的查詢方式,大家也可以自己添加。

?flask web開發(fā)實戰(zhàn),python編程,flask,python,后端

完整代碼?

@app.route('/grade_infos', methods=['GET', 'POST'])
def grade_infos():
    # login session值
    if flask.session.get("login", "") == '':
        # 用戶沒有登陸
        print('用戶還沒有登陸!即將重定向!')
        return flask.redirect('/')
    query_result = ''
    results = ''
    # 當用戶登陸有存儲信息時顯示用戶名,否則為空
    if users:
        for user in users:
            user_info = user
    else:
        user_info = ''
    # 獲取下拉框的數(shù)據(jù)
    if flask.request.method == 'POST':
        select = flask.request.form.get('selected_one')
        query = flask.request.values.get('query')
        print(select, query)
        # 判斷不同輸入對數(shù)據(jù)表進行不同的處理
        if select == '學號':
            try:
                sql = "select * from grade_infos where student_id = %s; "
                cursor.execute(sql, query)
                results = cursor.fetchall()
                if results:
                    query_result = '查詢成功!'
                else:
                    query_result = '查詢失敗!'
            except Exception as err:
                print(err)
                pass
        if select == '姓名':
            try:
                sql = "select * from grade_infos where student_id in(select student_id from students_infos where student_name=%s);"
                cursor.execute(sql, query)
                results = cursor.fetchall()
                if results:
                    query_result = '查詢成功!'
                else:
                    query_result = '查詢失敗!'
            except Exception as err:
                print(err)
                pass

        if select == '課程名稱':
            try:
                sql = "select * from grade_infos where student_class_id in(select student_class_id from students_infos where student_class_id=%s);"
                cursor.execute(sql, query)
                results = cursor.fetchall()
                if results:
                    query_result = '查詢成功!'
                else:
                    query_result = '查詢失敗!'
            except Exception as err:
                print(err)
                pass

        if select == "所在班級":
            try:
                sql = "select * from grade_infos where student_class_id in(select student_class_id from students_infos where student_class=%s);"
                cursor.execute(sql, query)
                results = cursor.fetchall()
                if results:
                    query_result = '查詢成功!'
                else:
                    query_result = '查詢失敗!'
            except Exception as err:
                print(err)
                pass
    return flask.render_template('grade_infos.html', query_result=query_result, user_info=user_info, results=results)

前端頁面?grade_infos.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>學生成績管理系統(tǒng)</title>
     <link rel="icon" >
     <link rel="stylesheet" type="text/css" href="../static/css/bootstrap.min.css"/>

        <style>
            .container {
            position: absolute;
            width: 100%;
            height: 100%;
    }
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 200px;
            background-color: #f1f1f1;
        }

        li a {
            display: block;
            color: #000;
            padding: 8px 16px;
            text-decoration: none;
        }

        li a.active {
            background-color: #4CAF50;
            color: white;
        }

        li a:hover:not(.active) {
            background-color: #555;
            color: white;
        }

        li {
            list-style: none;
        }

        a {
            text-decoration: none;
            color: white;
        }

        .header {
            position: relative;
            width: 100%;
            height: 55px;
            background-color: black;
        }

        .left {
            position: absolute;
            left: 20px;
            font-size: 20px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right {
            position: absolute;
            right: 160px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .right_right {
            position: absolute;
            right: 24px;
            line-height: 55px;
            color: white;
            text-align: center;
        }

        .leftside {
            float: left;
            background-color: rgb(245, 245, 245);
            /* height: 663px; */
            width: 230px;
        }

        .leftside ul {

            height: 663px;
        }

        .leftside .first {
            background-color: rgb(66, 139, 202);
            margin-top: 25px;

        }

        .leftside .first a {
            color: white;

        }

        .leftside {
            float: left;
            width: 200px;
            height: 100%;
        }

        .leftside ul li {

            border-bottom: 0.2px solid white;

            font-size: 20px;
            height: 60px;
            line-height: 60px;
            width: 100%;
            text-align: center;
        }


        .container-fluid {
            float: none;
            width: 100%;
            height: 100%;

        }


        .table-responsive {

            margin-top: 10px;
        }

        .table-striped {

            width: 1250px;
        }

        thead tr th {
            background-color: white;
        }


    </style>
</head>

<body>
<div class="container">
    <div class="header">
        <span class="left">學 生 成 績 查 詢</span>
        <span class="right">你 好,{{user_info}}老 師!</span>
        <span class="right_right"><a href="/">退出登陸</a></span>
    </div>
    <div class="leftside">
        <ul>
            <li><a href="/student">學生信息錄入</a></li>
            <li><a href ="/updata_student">學生信息修改</a></li>
            <li><a href="/teacher_class">老師開設(shè)課程查看</a></li>
            <li><a href="/teacher">選課信息錄入</a></li>
            <li><a href="/grade">成績信息錄入</a></li>
            <li class="first"><a href="#">學生成績查詢</a></li>
            <li><a href="/graduation">畢業(yè)去向</a></li>
            <li><a href="/adminstator">系統(tǒng)管理員變動</a></li>
        </ul>
    </div>
    <div class="container-fluid">
        <h1 class="sub-header">學 生 成 績 查 詢 系 統(tǒng)</h1>&nbsp;&nbsp;
        <hr>
        <div class="table-responsive">
            <table class="table table-striped" cellspaing="10">
      
                <tbody>
                    <tr>
                        <form action="" method="post">
                            <td><label for="#">請選擇查詢的方式:(學號/姓名/課程名稱/所在班級)</label>&nbsp;&nbsp;&nbsp;</td>
                            <td><select name="selected_one">
                                    <option value="學號" selected="selected">學號</option>
                                    <option value="姓名">姓名</option>
                                    <option value="課程號">課程號</option>
                                    <option value="所在班級">所在班級</option>
                                </select></td>&nbsp;
                            <td><input class="long" type="text" name="query"></td>
                            <td><input class="last" type="submit" value="查詢" /></td>
                            <td><span>查詢結(jié)果:{{query_result}}</span></td>
                        </form>
                    </tr>
                    <tr>
                        <td>學生學號</td>
                        <td>課程號</td>
                        <td>成績</td>
                    </tr>
                    {% for result in results %}
                    <tr>
                        <td>{{result[0]}}</td>
                        <td>{{result[1]}}</td>
                        <td>{{result[2]}}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>

    </div>
</div>
</body>

</html>

?五、總結(jié)

因為實現(xiàn)原理都是相似的,所以我就不一個個去寫了,就把增刪查改功能各寫一遍,剩下感興趣的可以自己去嘗試寫下,要相信自己!總體來說還是一個值得初學者去練習的項目。文章來源地址http://www.zghlxwxcb.cn/news/detail-559469.html

到了這里,關(guān)于python Web開發(fā) flask輕量級Web框架實戰(zhàn)項目--學生管理系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 輕量級web開發(fā)框架Flask本地部署及無公網(wǎng)ip遠程訪問界面

    輕量級web開發(fā)框架Flask本地部署及無公網(wǎng)ip遠程訪問界面

    本篇文章講解如何在本地安裝Flask,以及如何將其web界面發(fā)布到公網(wǎng)上并進行遠程訪問。 Flask是目前十分流行的web框架,采用Python編程語言來實現(xiàn)相關(guān)功能。較其他同類型框架更為靈活、輕便、安全且容易上手。它可以很好地結(jié)合MVC模式進行開發(fā),開發(fā)人員分工合作,小型團

    2024年02月04日
    瀏覽(87)
  • 輕量級Web框架Flask(二)

    MySQL是免費開源軟件,大家可以自行搜索其官網(wǎng)(https://www.MySQL.com/downloads/) 測試MySQL是否安裝成功 在所有程序中,找到MySQL→MySQL Server 5.6下面的命令行工具,然后單擊輸入密碼后回車,就可以知道MySQL數(shù)據(jù)庫是否鏈接成功。 右擊桌面上的“計算機”,在彈出的快捷鍵菜單中

    2023年04月15日
    瀏覽(183)
  • Python光速入門 - Flask輕量級框架

    Python光速入門 - Flask輕量級框架

    ????????FlASK是一個輕量級的WSGI Web應用程序框架,F(xiàn)lask的核心包括Werkzeug工具箱和Jinja2模板引擎,它沒有默認使用的數(shù)據(jù)庫或窗體驗證工具,這意味著用戶可以根據(jù)自己的需求選擇不同的數(shù)據(jù)庫和驗證工具。Flask的設(shè)計理念是保持核心簡單,同時提供強大的擴展性,用戶

    2024年03月14日
    瀏覽(225)
  • 深度學習模型部署——Flask框架輕量級部署+阿里云服務(wù)器

    深度學習模型部署——Flask框架輕量級部署+阿里云服務(wù)器

    ?因為參加一個比賽,需要把訓練好的深度學習模型部署到web端,第一次做,在網(wǎng)上也搜索了很多教程,基本上沒有適合自己的,只有一個b站up主講的還不錯 https://www.bilibili.com/video/BV1Qv41117SR/?spm_id_from=333.999.0.0vd_source=6ca6a313467efae52a28428a64104c10 https://www.bilibili.com/video/BV1Qv41117

    2024年02月07日
    瀏覽(95)
  • Qat++,輕量級開源C++ Web框架

    Qat++,輕量級開源C++ Web框架

    目錄 一.簡介 二.編譯Oat++ 1.環(huán)境 2.編譯/安裝 三.試用 1.創(chuàng)建一個 CMake 項目 2.自定義客戶端請求響應 3.將請求Router到服務(wù)器 4.用瀏覽器驗證 Oat++是一個面向C++的現(xiàn)代Web框架 官網(wǎng)地址:https://oatpp.io github地址:https://github.com/oatpp/oatpp Oat++具有如下特性: ●隨處運行 Oat++沒有任何

    2024年02月01日
    瀏覽(109)
  • 使用Go語言打造輕量級Web框架

    前言 Web框架是Web開發(fā)中不可或缺的組件。它們的主要目標是抽象出HTTP請求和響應的細節(jié),使開發(fā)人員可以更專注于業(yè)務(wù)邏輯的實現(xiàn)。在本篇文章中,我們將使用Go語言實現(xiàn)一個簡單的Web框架,類似于Gin框架。 功能 我們的Web框架需要實現(xiàn)以下功能: 路由:處理HTTP請求的路由

    2023年04月08日
    瀏覽(92)
  • 《Java Web輕量級整合開發(fā)入門》學習筆記

    《Java Web輕量級整合開發(fā)入門》學習筆記

    輕量級Java Web整合開發(fā) 第一章 輕量級Java Web開發(fā)概述 1.2? java web 開發(fā)概述 1.JSP是一種編譯執(zhí)行的前臺頁面技術(shù)。對于每個JSP頁面,Web服務(wù)器都會生成一個相應的Java文件,然后再編譯該Java文件,生成相應的Class類型文件。在客戶端訪問到的JSP頁面,就是相應Class文件執(zhí)行的結(jié)果

    2024年02月08日
    瀏覽(93)
  • 輕量級Web報表工具ActiveReportsJS全新發(fā)布v4.0,支持集成更多前端框架!

    輕量級Web報表工具ActiveReportsJS全新發(fā)布v4.0,支持集成更多前端框架!

    ActiveReportsJS?是一款基于 JavaScript 和 HTML5 的輕量級Web報表工具,采用拖拽式設(shè)計模式,不需任何服務(wù)器和組件支持,即可在 Mac、Linux 和 Windows 操作系統(tǒng)中,設(shè)計多種類型的報表。ActiveReportsJS 同時提供跨平臺報表設(shè)計、純前端報表展示、多數(shù)據(jù)源綁定、前端打印導出等功能,

    2024年02月15日
    瀏覽(97)
  • Linux項目實戰(zhàn)C++輕量級Web服務(wù)器源碼分析TinyWebServer

    Linux項目實戰(zhàn)C++輕量級Web服務(wù)器源碼分析TinyWebServer

    TinyWebServer是Linux下C++輕量級Web服務(wù)器,助力初學者快速實踐網(wǎng)絡(luò)編程,搭建屬于自己的服務(wù)器.作為新手拿它練手入門再好不過的不二之選,項目開發(fā)者社長也寫了一些文章幫助初學者理解,但是,非學習總結(jié)的總是容易忘,這里記錄一下學習過程。 源碼鏈接: https://github.co

    2024年02月16日
    瀏覽(23)
  • 用go設(shè)計開發(fā)一個自己的輕量級登錄庫/框架吧

    幾乎每個項目都會有登錄,退出等用戶功能,而登錄又不單僅僅是登錄,我們要考慮很多東西。 token該怎么生成?生成什么樣的? 是在Cookie存token還是請求頭存token?讀取的時候怎么讀?。?允許同一個賬號被多次登錄嗎?多次登錄他們的token是一樣的?還是不一樣的? 登錄也

    2024年02月03日
    瀏覽(91)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包