diff --git a/.idea/CyberExam.iml b/.idea/CyberExam.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/CyberExam.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CyberExam/__init__.py b/CyberExam/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/CyberExam/asgi.py b/CyberExam/asgi.py new file mode 100644 index 0000000..ac122d1 --- /dev/null +++ b/CyberExam/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for 不夜城考试 project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CyberExam.settings') + +application = get_asgi_application() diff --git a/CyberExam/settings.py b/CyberExam/settings.py new file mode 100644 index 0000000..c7f7c82 --- /dev/null +++ b/CyberExam/settings.py @@ -0,0 +1,137 @@ +""" +Django settings for CyberExam project. + +Generated by 'django-admin startproject' using Django 5.0.7. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.0/ref/settings/ +""" + +from pathlib import Path +import os + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-!78yd6se#zw2x9##j$x@$j9+q)cf!7%pham38azqz+p3j)chwe' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = False + +ALLOWED_HOSTS = ['*'] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'exam', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'CyberExam.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'] + , + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'django.template.context_processors.media', + ], + }, + }, +] + +WSGI_APPLICATION = 'CyberExam.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.0/topics/i18n/ + +LANGUAGE_CODE = 'zh-hans' + +TIME_ZONE = 'Asia/Shanghai' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.0/howto/static-files/ + +STATIC_URL = 'static/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static/'), + os.path.join(BASE_DIR, 'media/'), +] + +# Default primary key field type +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +MEDIA_URL = 'media/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') + +AUTH_USER_MODEL = 'exam.CyberUser' diff --git a/CyberExam/urls.py b/CyberExam/urls.py new file mode 100644 index 0000000..c3954aa --- /dev/null +++ b/CyberExam/urls.py @@ -0,0 +1,25 @@ +""" +URL configuration for 不夜城考试 project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the "include()" function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include +from django.conf.urls.static import static +from . import settings + +urlpatterns = [ + path('admin/', admin.site.urls), + path('exam/', include(('exam.urls', 'exam'), namespace='exam')), +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/CyberExam/wsgi.py b/CyberExam/wsgi.py new file mode 100644 index 0000000..d2a3203 --- /dev/null +++ b/CyberExam/wsgi.py @@ -0,0 +1,26 @@ +""" +WSGI config for 不夜城考试 project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +from os.path import join,dirname,abspath + + +PROJECT_DIR = dirname(dirname(abspath(__file__)))#3 +import sys # 4 +sys.path.insert(0,PROJECT_DIR) # 5 + + + + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CyberExam.settings') + +application = get_wsgi_application() diff --git a/static/images/backgrounds/img-1a.jpg b/static/images/backgrounds/img-1a.jpg new file mode 100644 index 0000000..9076f39 Binary files /dev/null and b/static/images/backgrounds/img-1a.jpg differ diff --git a/static/images/brand/icon1.png b/static/images/brand/icon1.png new file mode 100644 index 0000000..f4c245f Binary files /dev/null and b/static/images/brand/icon1.png differ diff --git a/templates/banner.html b/templates/banner.html new file mode 100644 index 0000000..d15cf05 --- /dev/null +++ b/templates/banner.html @@ -0,0 +1,52 @@ + \ No newline at end of file