diff --git a/.idea/IT_Show.iml b/.idea/IT_Show.iml
index 0e6b474..7447e63 100644
--- a/.idea/IT_Show.iml
+++ b/.idea/IT_Show.iml
@@ -13,7 +13,9 @@
-
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 6649a8c..a295f5a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b923b51..e06d154 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,12 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16,7 +64,9 @@
-
+
+
+
@@ -56,17 +106,49 @@
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ITShowPlatform/settings.py b/ITShowPlatform/settings.py
index 15069aa..b3ceb1c 100644
--- a/ITShowPlatform/settings.py
+++ b/ITShowPlatform/settings.py
@@ -11,11 +11,11 @@ https://docs.djangoproject.com/en/4.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/4.0/howto/deployment/checklist/
@@ -27,7 +27,6 @@ DEBUG = True
ALLOWED_HOSTS = []
-
# Application definition
INSTALLED_APPS = [
@@ -37,6 +36,11 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'rest_framework',
+ 'enroll',
+ 'history',
+ 'comments',
+
]
MIDDLEWARE = [
@@ -70,18 +74,20 @@ TEMPLATES = [
WSGI_APPLICATION = 'ITShowPlatform.wsgi.application'
-
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
+ 'ENGINE': 'django.db.backends.mysql',
+ 'NAME': "ITShowPlatform",
+ 'PORT': '3306',
+ 'PASSWORD': 'HNXhnx123',
+ 'USER': 'root',
+ 'HOST': '127.0.0.1'
}
}
-
# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
@@ -100,25 +106,42 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
-
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
-LANGUAGE_CODE = 'en-us'
+LANGUAGE_CODE = 'zh-Hans'
-TIME_ZONE = 'UTC'
+TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
-USE_TZ = True
+USE_L10N = True
+USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
-STATIC_URL = 'static/'
+STATIC_URL = '/static/'
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
+MEDIA_URL = '/media/'
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+
+REST_FRAMEWORK = {
+ 'DEFAULT_RENDERER_CLASSES': ( # 默认响应渲染类
+ 'rest_framework.renderers.JSONRenderer', # json渲染器
+ 'rest_framework.renderers.BrowsableAPIRenderer', # 浏览API渲染器
+ )
+}
+
+EMAIL_HOST = "smtp.qq.com" # 服务器
+EMAIL_PORT = 465
+EMAIL_HOST_USER = "2302253692@qq.com" # 账号
+EMAIL_HOST_PASSWORD = "idujbpdlpgbmdhjg" # 密码 (注意:这里的密码指的是授权码)
+EMAIL_USE_SSL = True # 一般都为False
+EMAIL_FROM = "2302253692@qq.com" # 邮箱来自
diff --git a/ITShowPlatform/urls.py b/ITShowPlatform/urls.py
index 2ef3b7c..0e97036 100644
--- a/ITShowPlatform/urls.py
+++ b/ITShowPlatform/urls.py
@@ -14,8 +14,15 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
-from django.urls import path
+from django.urls import path, re_path, include
+from django.views.static import serve
+from ITShowPlatform import settings
+from rest_framework import routers
urlpatterns = [
path('admin/', admin.site.urls),
+ path('api/', include('comments.urls')),
+ path('api/', include('history.urls')),
+ path(r'^api-auth/', include('rest_framework.urls')),
+ re_path(r'^media/(?P.*)', serve, {"document_root": settings.MEDIA_ROOT}),
]
diff --git a/IT_Show/__init__.py b/IT_Show/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/IT_Show/asgi.py b/IT_Show/asgi.py
deleted file mode 100644
index 6872961..0000000
--- a/IT_Show/asgi.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-ASGI config for IT_Show 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/3.2/howto/deployment/asgi/
-"""
-
-import os
-
-from django.core.asgi import get_asgi_application
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'IT_Show.settings')
-
-application = get_asgi_application()
diff --git a/IT_Show/settings.py b/IT_Show/settings.py
deleted file mode 100644
index a63a0c2..0000000
--- a/IT_Show/settings.py
+++ /dev/null
@@ -1,145 +0,0 @@
-"""
-Django settings for IT_Show project.
-
-Generated by 'django-admin startproject' using Django 3.2.5.
-
-For more information on this file, see
-https://docs.djangoproject.com/en/3.2/topics/settings/
-
-For the full list of settings and their values, see
-https://docs.djangoproject.com/en/3.2/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/3.2/howto/deployment/checklist/
-
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'django-insecure-f9_1pqmcnv!w0xp#vchj9e06_b-r!ahy@=w__j0^2#w2s)fa-o'
-
-# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
-
-ALLOWED_HOSTS = []
-
-
-# Application definition
-
-INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'rest_framework',
- 'history',
- 'comments',
-]
-
-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 = 'IT_Show.urls'
-
-TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [os.path.join(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',
- ],
- },
- },
-]
-
-WSGI_APPLICATION = 'IT_Show.wsgi.application'
-
-
-# Database
-# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': "IT_Show",
- 'PORT': '3306',
- 'PASSWORD': 'Qq2442402635*',
- 'USER': 'root',
- 'HOST': '127.0.0.1'
- }
-}
-
-
-# Password validation
-# https://docs.djangoproject.com/en/3.2/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/3.2/topics/i18n/
-
-LANGUAGE_CODE = 'zh-Hans'
-
-TIME_ZONE = 'Asia/Shanghai'
-
-USE_I18N = True
-
-USE_L10N = True
-
-USE_TZ = False
-
-
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/3.2/howto/static-files/
-
-STATIC_URL = '/static/'
-STATIC_ROOT = os.path.join(BASE_DIR, 'static')
-MEDIA_URL = '/media/'
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
-
-
-# Default primary key field type
-# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
-
-DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
-
-REST_FRAMEWORK = {
- 'DEFAULT_RENDERER_CLASSES': ( # 默认响应渲染类
- 'rest_framework.renderers.JSONRenderer', # json渲染器
- 'rest_framework.renderers.BrowsableAPIRenderer', # 浏览API渲染器
- )
-}
diff --git a/IT_Show/urls.py b/IT_Show/urls.py
deleted file mode 100644
index e89d0fa..0000000
--- a/IT_Show/urls.py
+++ /dev/null
@@ -1,28 +0,0 @@
-"""IT_Show URL Configuration
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/3.2/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, re_path
-from django.views.static import serve
-from IT_Show import settings
-
-
-urlpatterns = [
- path('admin/', admin.site.urls),
- path('api/', include('comments.urls')),
- path('api/', include('history.urls')),
- path(r'^api-auth/', include('rest_framework.urls')),
- re_path(r'^media/(?P.*)', serve, {"document_root": settings.MEDIA_ROOT}),
-]
diff --git a/IT_Show/wsgi.py b/IT_Show/wsgi.py
deleted file mode 100644
index 160a818..0000000
--- a/IT_Show/wsgi.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-WSGI config for IT_Show 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/3.2/howto/deployment/wsgi/
-"""
-
-import os
-
-from django.core.wsgi import get_wsgi_application
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'IT_Show.settings')
-
-application = get_wsgi_application()
diff --git a/history/urls.py b/history/urls.py
index 827f21f..6c099cc 100644
--- a/history/urls.py
+++ b/history/urls.py
@@ -2,7 +2,7 @@ from django.contrib import admin
from django.urls import path
from . import views
from django.conf.urls.static import static
-from IT_Show import settings
+from ITShowPlatform import settings
urlpatterns = [
path('history/', views.history.as_view()),
diff --git a/it/__init__.py b/it/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/it/asgi.py b/it/asgi.py
deleted file mode 100644
index a3c6818..0000000
--- a/it/asgi.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-ASGI config for it 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/4.0/howto/deployment/asgi/
-"""
-
-import os
-
-from django.core.asgi import get_asgi_application
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'it.settings')
-
-application = get_asgi_application()
diff --git a/it/settings.py b/it/settings.py
deleted file mode 100644
index d42c015..0000000
--- a/it/settings.py
+++ /dev/null
@@ -1,137 +0,0 @@
-"""
-Django settings for it project.
-
-Generated by 'django-admin startproject' using Django 4.0.4.
-
-For more information on this file, see
-https://docs.djangoproject.com/en/4.0/topics/settings/
-
-For the full list of settings and their values, see
-https://docs.djangoproject.com/en/4.0/ref/settings/
-"""
-
-from pathlib import Path
-
-# 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/4.0/howto/deployment/checklist/
-
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'django-insecure-t2!&uy392o58_cd^(i_5xyn=7@^abwkurjyn9un&c_w=@#hech'
-
-# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
-
-ALLOWED_HOSTS = []
-
-
-# Application definition
-
-INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'enroll',
- 'rest_framework',
-]
-
-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 = 'it.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',
- ],
- },
- },
-]
-
-WSGI_APPLICATION = 'it.wsgi.application'
-
-
-# Database
-# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': 'it_show',
- 'USER': 'root',
- 'PASSWORD': '123456',
- 'HOST': '127.0.0.1',
- 'PORT': 3306,
- }
-}
-
-
-# Password validation
-# https://docs.djangoproject.com/en/4.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/4.0/topics/i18n/
-
-LANGUAGE_CODE = 'en-us'
-
-TIME_ZONE = 'UTC'
-
-USE_I18N = True
-
-USE_TZ = True
-
-
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/4.0/howto/static-files/
-
-STATIC_URL = 'static/'
-
-# Default primary key field type
-# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
-
-DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
-
-EMAIL_HOST = "smtp.qq.com" # 服务器
-EMAIL_PORT = 465
-EMAIL_HOST_USER = "2302253692@qq.com" # 账号
-EMAIL_HOST_PASSWORD = "" # 密码 (注意:这里的密码指的是授权码)
-EMAIL_USE_SSL = True # 一般都为False
-EMAIL_FROM = "2302253692@qq.com" # 邮箱来自
diff --git a/it/urls.py b/it/urls.py
deleted file mode 100644
index 66f29b7..0000000
--- a/it/urls.py
+++ /dev/null
@@ -1,22 +0,0 @@
-"""it URL Configuration
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/4.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
-
-urlpatterns = [
- path('admin/', admin.site.urls),
- path('', include('enroll.urls')),
-]
diff --git a/it/wsgi.py b/it/wsgi.py
deleted file mode 100644
index 356d8ef..0000000
--- a/it/wsgi.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-WSGI config for it 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/4.0/howto/deployment/wsgi/
-"""
-
-import os
-
-from django.core.wsgi import get_wsgi_application
-
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'it.settings')
-
-application = get_wsgi_application()