├── onlineExam ├── student │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ ├── 0001_initial.cpython-37.pyc │ │ │ ├── 0002_auto_20190609_1126.cpython-37.pyc │ │ │ ├── 0003_auto_20190609_1128.cpython-37.pyc │ │ │ ├── 0004_auto_20190609_1134.cpython-37.pyc │ │ │ ├── 0005_auto_20190609_1914.cpython-37.pyc │ │ │ └── 0006_auto_20200702_2217.cpython-37.pyc │ │ ├── 0002_auto_20190609_1126.py │ │ ├── 0003_auto_20190609_1128.py │ │ ├── 0005_auto_20190609_1914.py │ │ ├── 0006_auto_20200702_2217.py │ │ ├── 0004_auto_20190609_1134.py │ │ └── 0001_initial.py │ ├── tests.py │ ├── apps.py │ ├── admin.py │ ├── models.py │ └── views.py ├── onlineExam │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-37.pyc │ │ ├── wsgi.cpython-37.pyc │ │ ├── __init__.cpython-37.pyc │ │ └── settings.cpython-37.pyc │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── requirements.txt ├── __pycache__ │ └── manage.cpython-37.pyc ├── .idea │ ├── encodings.xml │ ├── modules.xml │ ├── misc.xml │ ├── watcherTasks.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── onlineExam.iml │ └── workspace.xml ├── manage.py ├── templates │ ├── test.html │ └── index.html └── static │ ├── css │ ├── main.css │ └── test.css │ ├── bootstrap-4.3.1-dist │ └── css │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.min.css.map │ │ └── bootstrap-grid.min.css │ └── js │ ├── jquery.easy-pie-chart.js │ └── jquery.countdown.js ├── 关于系统.txt ├── README.md └── mysql数据库 └── exam.sql /onlineExam/student/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /关于系统.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/关于系统.txt -------------------------------------------------------------------------------- /onlineExam/student/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/__init__.py: -------------------------------------------------------------------------------- 1 | import pymysql 2 | pymysql.version_info=(1,3,13,"final",0) 3 | pymysql.install_as_MySQLdb() -------------------------------------------------------------------------------- /onlineExam/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.2.10 2 | Django==3.0.7 3 | PyMySQL==0.9.3 4 | pytz==2020.1 5 | sqlparse==0.3.1 6 | -------------------------------------------------------------------------------- /onlineExam/student/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class StudentConfig(AppConfig): 5 | name = 'student' 6 | -------------------------------------------------------------------------------- /onlineExam/__pycache__/manage.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/__pycache__/manage.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0002_auto_20190609_1126.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0002_auto_20190609_1126.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0003_auto_20190609_1128.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0003_auto_20190609_1128.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0004_auto_20190609_1134.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0004_auto_20190609_1134.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0005_auto_20190609_1914.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0005_auto_20190609_1914.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0006_auto_20200702_2217.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0006_auto_20200702_2217.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /onlineExam/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for onlineExam project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineExam.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0002_auto_20190609_1126.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('2', 'general'), ('1', 'easy')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0003_auto_20190609_1128.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0002_auto_20190609_1126'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('1', 'easy'), ('3', 'difficult'), ('2', 'general')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0005_auto_20190609_1914.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 11:14 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0004_auto_20190609_1134'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('2', 'general'), ('1', 'easy')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineExam.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0006_auto_20200702_2217.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.7 on 2020-07-02 14:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0005_auto_20190609_1914'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('1', 'easy'), ('2', 'general')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/urls.py: -------------------------------------------------------------------------------- 1 | 2 | from django.contrib import admin 3 | from django.urls import path 4 | from django.conf.urls import url 5 | from student import views 6 | 7 | urlpatterns = [ 8 | #管理员登陆 9 | path('admin/', admin.site.urls), 10 | #学生登陆 11 | url(r'^studentLogin/',views.studentLogin), 12 | #教师登陆 13 | url(r'^teacherLogin/',views.teacherLogin), 14 | #默认访问首页 15 | url(r'^$',views.index), 16 | url(r'^toIndex/$',views.toIndex), 17 | url('showGrade',views.showGrade), 18 | url('queryStudent',views.queryStudent), 19 | url(r'^startExam/$',views.startExam), 20 | url(r'^calGrade/$',views.calGrade), 21 | url(r'^logout/$',views.logOut), 22 | ] 23 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0004_auto_20190609_1134.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:34 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0003_auto_20190609_1128'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='grade', 15 | name='subject', 16 | field=models.CharField(default='', max_length=20, verbose_name='科目'), 17 | ), 18 | migrations.AlterField( 19 | model_name='question', 20 | name='level', 21 | field=models.CharField(choices=[('2', 'general'), ('1', 'easy'), ('3', 'difficult')], max_length=10, verbose_name='等级'), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python_Django_online_exam 2 | Python基于Django在线考试系统设计毕业源码案例设计 3 | 4 | ## 开发环境: Pycharm + Python3.7 + Django3.0 + mysql5.6 5 | 6 | ### 系统需求如下: 7 | (1)系统登录:验证登录用户的身份,根据用户身份进入不同的页面。 8 | (2)学生管理:供管理员使用,用于维护学生基本信息。 9 | (3)老师管理:供管理员使用,用于维护教师的基本信息。 10 | (4)试题管理:供教师管理,用于维护题库。 11 | (5)组卷:供教师使用,教师可以根据考试科目,从题库中选择一些符合条件的试题,形成一份试卷。为了方便教师组卷,应提供方便的查询功能,使教师能查询不同要求的试题。 12 | (6)在线考试:供学生使用,根据学生的班级和登录时间显示应考科目的试卷内容。试卷完成提交或考试时间到,不再允许学生修改试卷;实现自动评阅,记录学生的考试成绩,并将评阅结果提供给学生。 13 | (7)成绩统计:供教师使用,按照科目、班级等统计学生的考试成绩。 14 | (8)成绩查询:供教师和学生使用,提供不同查询方式,使教师和学生可以按需查询考试成绩。 15 | 16 | ### 2.设计思路 17 | (1)确定角色 18 | 由需求分析看出,系统有三个基本角色,学生、教师、管理员。 19 | 管理员负责后台信息的维护 20 | 系统要能实现自动阅卷功能 21 | (2)数据库表的设计 22 | 因此,我们至少需要如下几个表: 23 | 学生表 student 24 | 教师表 teacher 25 | 题库表 question(为了方便,题库中都为单项选择题) 26 | 试卷表 paper 27 | 学生成绩表 grade 28 | 设计完表,我们还需要确定表间的关系,是1对1(1:1),1对多(1:n),还是多对多(n:m),这很重要,因为后面我们在models.py中创建表时,需要指出表间关系。显然学生表和成绩表,1个学生可参加多门考试,会有多个成绩,学生表和成绩表为1:n;教师表和试卷表,1个教师会发布多套试卷,但1套试卷只能由1位教师发布,教师表和试卷表为1:n;试卷表和题库表,1套试卷里包含多道题,题库里的每道题也可出现在多个试卷中,故试卷表和题库表为n:m 29 | -------------------------------------------------------------------------------- /onlineExam/.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /onlineExam/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /onlineExam/templates/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Duplicate behavior to the data-* attribute for our tooltip plugin\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Remove the bottom border in Firefox 39-.\n// 5. Prevent the text-decoration to be skipped.\n\nabbr[title],\nabbr[data-original-title] { // 1\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 4\n text-decoration-skip-ink: none; // 5\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\nb,\nstrong {\n font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n\nsmall {\n @include font-size(80%); // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n @include font-size(75%);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-monospace;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n}\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg {\n // Workaround for the SVG overflow bug in IE10/11 is still required.\n // See https://github.com/twbs/bootstrap/issues/26878\n overflow: hidden;\n vertical-align: middle;\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $table-caption-color;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `