├── readme.txt ├── exams ├── __init__.py ├── migrations │ └── __init__.py ├── models.pyc ├── tests.py ├── views.pyc ├── __init__.pyc ├── admin.py ├── apps.py ├── models.py └── views.py ├── pyExam ├── __init__.py ├── urls.pyc ├── wsgi.pyc ├── __init__.pyc ├── settings.pyc ├── wsgi.py ├── urls.py └── settings.py ├── users ├── __init__.py ├── migrations │ └── __init__.py ├── models.pyc ├── tests.py ├── views.pyc ├── __init__.pyc ├── admin.py ├── apps.py ├── models.py └── views.py ├── problems ├── __init__.py ├── migrations │ └── __init__.py ├── admin.py ├── models.pyc ├── tests.py ├── utils.pyc ├── views.pyc ├── __init__.pyc ├── apps.py ├── utils.py ├── models.py └── views.py ├── templates ├── registerCheck.html ├── loginCheck.html ├── info.html ├── register.html ├── login.html ├── addProblems.html ├── showExams.html ├── addProblem.html ├── editProblem.html ├── showProblems.html └── addExam.html ├── db.sqlite3 └── manage.py /readme.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exams/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyExam/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /problems/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exams/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /users/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /problems/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/registerCheck.html: -------------------------------------------------------------------------------- 1 | 2 |

注册成功

3 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/db.sqlite3 -------------------------------------------------------------------------------- /exams/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/exams/models.pyc -------------------------------------------------------------------------------- /exams/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /exams/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/exams/views.pyc -------------------------------------------------------------------------------- /pyExam/urls.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/pyExam/urls.pyc -------------------------------------------------------------------------------- /pyExam/wsgi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/pyExam/wsgi.pyc -------------------------------------------------------------------------------- /users/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/users/models.pyc -------------------------------------------------------------------------------- /users/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /users/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/users/views.pyc -------------------------------------------------------------------------------- /exams/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/exams/__init__.pyc -------------------------------------------------------------------------------- /exams/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /problems/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /problems/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/problems/models.pyc -------------------------------------------------------------------------------- /problems/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /problems/utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/problems/utils.pyc -------------------------------------------------------------------------------- /problems/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/problems/views.pyc -------------------------------------------------------------------------------- /pyExam/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/pyExam/__init__.pyc -------------------------------------------------------------------------------- /pyExam/settings.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/pyExam/settings.pyc -------------------------------------------------------------------------------- /users/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/users/__init__.pyc -------------------------------------------------------------------------------- /users/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /problems/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LonelyOrion/pyExam/HEAD/problems/__init__.pyc -------------------------------------------------------------------------------- /templates/loginCheck.html: -------------------------------------------------------------------------------- 1 | 2 | 登录成功!{{ user.nickname }} 3 | 4 | -------------------------------------------------------------------------------- /templates/info.html: -------------------------------------------------------------------------------- 1 | 2 | {{ info }} 3 | 4 | -------------------------------------------------------------------------------- /exams/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class ExamsConfig(AppConfig): 7 | name = 'exams' 8 | -------------------------------------------------------------------------------- /users/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class UsersConfig(AppConfig): 7 | name = 'users' 8 | -------------------------------------------------------------------------------- /problems/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class ProblemsConfig(AppConfig): 7 | name = 'problems' 8 | -------------------------------------------------------------------------------- /problems/utils.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | class IDGenerator(): 5 | def getRandomID(self): 6 | myID = str(int(time.time())) 7 | for i in range(0, 8): 8 | myID += (random.choice('0123456789')) 9 | return myID -------------------------------------------------------------------------------- /templates/register.html: -------------------------------------------------------------------------------- 1 | 2 |
{% csrf_token %} 3 | 用户名:
4 | 昵称:
5 | 密码:
6 | 7 |
8 | -------------------------------------------------------------------------------- /exams/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | from mongoengine import * 5 | import sys 6 | sys.path.append('..') 7 | from problems.models import Problems 8 | # Create your models here. 9 | 10 | connect('pyExam') 11 | 12 | class Exams(Document): 13 | name = StringField(required = True) 14 | problems = ListField(ReferenceField(Problems)) -------------------------------------------------------------------------------- /problems/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | from mongoengine import * 5 | 6 | # Create your models here. 7 | 8 | connect('pyExam') 9 | 10 | class Problems(Document): 11 | myID = StringField() 12 | problem = StringField() 13 | options = ListField(StringField(), default=list) 14 | answer = StringField() 15 | type = StringField() -------------------------------------------------------------------------------- /users/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | from mongoengine import * 5 | # Create your models here. 6 | 7 | connect('pyExam') 8 | 9 | class Users(Document): 10 | username = StringField(max_length = 30, required = True) 11 | password = StringField(max_length = 30, required = True) 12 | nickname = StringField(max_length = 30, required = True) -------------------------------------------------------------------------------- /templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | Login page
3 | 4 |
{% csrf_token %} 5 | Username:
6 |
7 | Password:
8 |
9 | 10 |
11 |
{% csrf_token %} 12 | 13 |
14 | -------------------------------------------------------------------------------- /pyExam/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for pyExam 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/1.10/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", "pyExam.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /templates/addProblems.html: -------------------------------------------------------------------------------- 1 | 2 |
{% csrf_token %} 3 |
4 | 题目:

5 | 类型:
6 | 单选 7 | 多选 8 | 判断
9 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /templates/showExams.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

您好,{{ nickname }}

4 | 5 |
6 | 7 | 8 | 9 | {% for exam in exams %} 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% endfor %} 24 |
{{ exam.name }} 13 | {% for problem in exam.problems %} 14 | {{ problem.problem }}
15 | {% endfor %} 16 |
25 | -------------------------------------------------------------------------------- /templates/addProblem.html: -------------------------------------------------------------------------------- 1 | 2 |
{% csrf_token %} 3 |
4 | 题干:

5 | 选项:

6 | 答案:

7 | 类型:
8 | 单选 9 | 多选 10 | 判断
11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /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", "pyExam.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /templates/editProblem.html: -------------------------------------------------------------------------------- 1 | 2 |
{% csrf_token %} 3 |
4 | 5 | 题干:

6 | 选项:

7 | 答案:

8 | 类型:
9 | 单选 10 | 多选 11 | 判断
12 | 13 |
14 |
15 | -------------------------------------------------------------------------------- /exams/views.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from django.shortcuts import render 3 | from django.http import HttpResponseRedirect 4 | from models import Exams 5 | sys.path.append('..') 6 | from problems.models import Problems 7 | 8 | # Create your views here. 9 | 10 | def showExams(request): 11 | nickname = request.session['nickname'] 12 | exams = Exams.objects().all() 13 | return render(request, 'showExams.html', locals()) 14 | 15 | def addExam(request): 16 | singles = Problems.objects(type='single') 17 | multiples = Problems.objects(type='multiple') 18 | corrections = Problems.objects(type='correction') 19 | return render(request, 'addExam.html', locals()) 20 | 21 | def addExamCheck(request): 22 | exam = Exams(name="test") 23 | 24 | singles = Problems.objects(type='single') 25 | for single in singles: 26 | if request.POST[single.myID] == 'true': 27 | exam.problems.append(single) 28 | exam.save() 29 | #multiples = Problems.objects(type='multiple') 30 | #corrections = Problems.objects(type='correction') 31 | return HttpResponseRedirect('/showExams/') 32 | -------------------------------------------------------------------------------- /templates/showProblems.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

您好,{{ nickname }}

4 | 5 | 6 |
7 | 8 | 9 | 10 | {% for problem in problems %} 11 | 12 | 13 | 14 | 19 | 24 | 25 | 26 | 27 | 28 | {% endfor %} 29 |
序号题干题肢题型答案操作
{{ forloop.counter }}{{ problem.problem }} 15 | {% for option in problem.options %} 16 | {{ option }} 17 | {% endfor %} 18 | 20 | {% ifequal problem.type 'single' %}单选{% endifequal %} 21 | {% ifequal problem.type 'multiple' %}多选{% endifequal %} 22 | {% ifequal problem.type 'correction' %}判断{% endifequal %} 23 | {{ problem.answer }}
30 | -------------------------------------------------------------------------------- /users/views.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | from django.shortcuts import render 3 | from django.http import HttpResponse, Http404 4 | from models import Users 5 | 6 | # Create your views here. 7 | def login(request): 8 | return render(request, 'login.html') 9 | 10 | def logout(request): 11 | try: 12 | del request.session['username'] 13 | del request.session['nickname'] 14 | except: 15 | pass 16 | return render(request, 'info.html', {'info': '登出成功', 'link':'/login/'}) 17 | 18 | def loginCheck(request): 19 | try: 20 | username = request.POST['username'] 21 | password = request.POST['password'] 22 | except: 23 | return render(request, 'info.html', {'info': '错误的访问方式', 'link':'/login/'}) 24 | 25 | user = Users.objects(username=username).first() 26 | if not user: 27 | return render(request, 'info.html', {'info': '用户不存在', 'link':'/login/'}) 28 | 29 | if password != user.password: 30 | return render(request, 'info.html', {'info': '密码错误', 'link':'/login/'}) 31 | 32 | request.session['username'] = user.username 33 | request.session['nickname'] = user.nickname 34 | 35 | return render(request, 'loginCheck.html', {'user': user}) 36 | 37 | def register(request): 38 | return render(request, 'register.html') 39 | 40 | def registerCheck(request): 41 | try: 42 | username = request.POST['username'] 43 | password = request.POST['password'] 44 | nickname = request.POST['nickname'] 45 | except: 46 | return render(request, 'info.html', {'info': '错误的访问方式', 'link':'/login/'}) 47 | 48 | user = Users.objects(username = username) 49 | if len(user) == 0: 50 | user = Users(username = username, password = password, nickname = nickname) 51 | user.save() 52 | else: 53 | return render(request, 'info.html', {'info': '用户已存在', 'link':'/login/'}) 54 | return render(request, 'registerCheck.html') -------------------------------------------------------------------------------- /pyExam/urls.py: -------------------------------------------------------------------------------- 1 | """pyExam URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | from django.contrib import admin 18 | import users.views 19 | import exams.views 20 | import problems.views 21 | 22 | urlpatterns = [ 23 | url(r'^admin/', admin.site.urls), 24 | 25 | url(r'^login/$', users.views.login), 26 | url(r'^loginCheck/$', users.views.loginCheck), 27 | url(r'^register/$', users.views.register), 28 | url(r'^registerCheck/$', users.views.registerCheck), 29 | 30 | url(r'^showProblems/$', problems.views.showProblems), 31 | url(r'^addProblem/$', problems.views.addProblem), 32 | url(r'^addProblems/$', problems.views.addProblems), 33 | url(r'^editProblem/$', problems.views.editProblem), 34 | url(r'^deleteProblem/$', problems.views.deleteProblem), 35 | url(r'^editProblemCheck/$', problems.views.editProblemCheck), 36 | url(r'^addProblemCheck/$', problems.views.addProblemCheck), 37 | url(r'^addProblemsCheck/$', problems.views.addProblemsCheck), 38 | 39 | url(r'^showExams/$', exams.views.showExams), 40 | url(r'^addExam/$', exams.views.addExam), 41 | url(r'^addExamCheck/$', exams.views.addExamCheck) 42 | ] 43 | -------------------------------------------------------------------------------- /templates/addExam.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
{% csrf_token %} 4 | 考试名:
5 | 6 | 单选题:
7 | 8 | 9 | {% for single in singles %} 10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | {% endfor %} 22 |
序号题干题肢答案是否选择
{{ forloop.counter }}{{ single.problem }} 14 | {% for option in single.options %} 15 | {{ option }} 16 | {% endfor %} 17 | {{ single.answer }}
23 | 多选题:
24 | 25 | 26 | {% for multiple in multiples %} 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | {% endfor %} 39 |
序号题干题肢答案是否选择
{{ forloop.counter }}{{ multiple.problem }} 31 | {% for option in multiple.options %} 32 | {{ option }} 33 | {% endfor %} 34 | {{ multiple.answer }}
40 | 判断题:
41 | 42 | 43 | {% for correction in corrections %} 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | {% endfor %} 56 |
序号题干题肢答案是否选择
{{ forloop.counter }}{{ correction.problem }} 48 | {% for option in correction.options %} 49 | {{ option }} 50 | {% endfor %} 51 | {{ correction.answer }}
57 | 58 |
59 |
60 | -------------------------------------------------------------------------------- /problems/views.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | from django.shortcuts import render 3 | from django.http import HttpResponseRedirect 4 | from models import Problems 5 | from utils import IDGenerator 6 | 7 | # Create your views here. 8 | 9 | def showProblems(request): 10 | nickname = request.session['nickname'] 11 | problems = Problems.objects() 12 | return render(request, 'showProblems.html', locals()) 13 | 14 | def addProblem(request): 15 | return render(request, 'addProblem.html') 16 | def addProblems(request): 17 | return render(request, 'addProblems.html') 18 | 19 | def addProblemCheck(request): 20 | try: 21 | rawProblem = request.POST['problem'].strip('\r\n') 22 | rawOptions = request.POST['options'].split('\r\n') 23 | rawAnswer = request.POST['answer'].strip('\r\n') 24 | rawType = request.POST['type'] 25 | except: 26 | return render(request, 'info.html', {'info': '提交内容不完整', 'link': '/showProblems/'}) 27 | 28 | myID = IDGenerator().getRandomID() 29 | problem = Problems(myID = myID, problem = rawProblem, options = rawOptions, answer = rawAnswer, type = rawType) 30 | problem.save() 31 | 32 | return HttpResponseRedirect('/showProblems/') 33 | 34 | def addProblemsCheck(request): 35 | try: 36 | problems = request.POST['problems'] 37 | rawType = request.POST['type'] 38 | except: 39 | return render(request, 'info.html', {'info': '提交内容不完整', 'link': '/showProblems/'}) 40 | 41 | problems = problems.split('\r\n\r\n') #warning: this may be different in different browsers 42 | for problem in problems: 43 | arr = problem.split('\r\n') 44 | rawProblem = arr[0] 45 | rawAnswer = arr[-1] 46 | rawOptions = arr[1: -1] 47 | 48 | myID = IDGenerator().getRandomID() 49 | newProblem = Problems(myID = myID, problem = rawProblem, options = rawOptions, answer = rawAnswer, type = rawType) 50 | newProblem.save() 51 | return HttpResponseRedirect('/showProblems/') 52 | 53 | def editProblem(request): 54 | try: 55 | myID = request.GET['myID'] 56 | except: 57 | return render(request, 'info.html', {'info': '错误的请求方式', 'link': '/showProblems/'}) 58 | problem = Problems.objects(myID = myID).first() 59 | if not problem: 60 | return render(request, 'info.html', {'info': '错误的请求ID', 'link': '/showProblems/'}) 61 | 62 | problem.options = '\n'.join(problem.options) 63 | print problem.options 64 | return render(request, 'editProblem.html', {'problem': problem}) 65 | 66 | def editProblemCheck(request): 67 | try: 68 | rawProblem = request.POST['problem'] 69 | rawOptions = request.POST['options'] 70 | rawAnswer = request.POST['answer'] 71 | myID = request.POST['myID'] 72 | rawType = request.POST['type'] 73 | except: 74 | return render(request, 'info.html', {'info': '提交内容不完整', 'link':'/showProblems/'}) 75 | 76 | problem = Problems.objects(myID = myID).first() 77 | if not problem: 78 | return render(request, 'info.html', {'info': '错误的请求ID', 'link':'/showProblems/'}) 79 | 80 | problem.problem = rawProblem.strip('\r\n') 81 | problem.options = rawOptions.split('\r\n') 82 | problem.answer = rawAnswer 83 | problem.type = rawType 84 | problem.save() 85 | 86 | return HttpResponseRedirect('/showProblems/') 87 | 88 | def deleteProblem(request): 89 | try: 90 | myID = request.GET['myID'] 91 | except: 92 | return render(request, 'info.html', {'info': '错误的请求方式', 'link':'/showProblems/'}) 93 | 94 | problem = Problems.objects(myID = myID).first() 95 | if not problem: 96 | return render(request, 'info.html', {'info': '错误的请求ID', 'link':'/showProblems/'}) 97 | 98 | problem.delete() 99 | return HttpResponseRedirect('/showProblems/') -------------------------------------------------------------------------------- /pyExam/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for pyExam project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.10.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.10/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '@0shn)6d7vgg#9dv7fy0=l$**boi$+qimin-y)kry%0vg6)2vs' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | ] 41 | 42 | MIDDLEWARE = [ 43 | 'django.middleware.security.SecurityMiddleware', 44 | 'django.contrib.sessions.middleware.SessionMiddleware', 45 | 'django.middleware.common.CommonMiddleware', 46 | 'django.middleware.csrf.CsrfViewMiddleware', 47 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 48 | 'django.contrib.messages.middleware.MessageMiddleware', 49 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 50 | ] 51 | 52 | ROOT_URLCONF = 'pyExam.urls' 53 | 54 | TEMPLATES = [ 55 | { 56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 57 | 'DIRS': [os.path.join(BASE_DIR, 'templates').replace('\\', '/')], 58 | 'APP_DIRS': True, 59 | 'OPTIONS': { 60 | 'context_processors': [ 61 | 'django.template.context_processors.debug', 62 | 'django.template.context_processors.request', 63 | 'django.contrib.auth.context_processors.auth', 64 | 'django.contrib.messages.context_processors.messages', 65 | ], 66 | }, 67 | }, 68 | ] 69 | 70 | WSGI_APPLICATION = 'pyExam.wsgi.application' 71 | 72 | 73 | # Database 74 | # https://docs.djangoproject.com/en/1.10/ref/settings/#databases 75 | 76 | DATABASES = { 77 | 'default': { 78 | 'ENGINE': 'django.db.backends.sqlite3', 79 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 80 | } 81 | } 82 | 83 | 84 | # Password validation 85 | # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators 86 | 87 | AUTH_PASSWORD_VALIDATORS = [ 88 | { 89 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 90 | }, 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 99 | }, 100 | ] 101 | 102 | 103 | # Internationalization 104 | # https://docs.djangoproject.com/en/1.10/topics/i18n/ 105 | 106 | LANGUAGE_CODE = 'en-us' 107 | 108 | TIME_ZONE = 'UTC' 109 | 110 | USE_I18N = True 111 | 112 | USE_L10N = True 113 | 114 | USE_TZ = True 115 | 116 | 117 | # Static files (CSS, JavaScript, Images) 118 | # https://docs.djangoproject.com/en/1.10/howto/static-files/ 119 | 120 | STATIC_URL = '/static/' 121 | --------------------------------------------------------------------------------