|
@@ -1,5 +1,5 @@
|
|
"""
|
|
"""
|
|
-Django settings for Test_laboratory project.
|
|
|
|
|
|
+Django settings for TestLaboratory project.
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 3.2.
|
|
Generated by 'django-admin startproject' using Django 3.2.
|
|
|
|
|
|
@@ -9,20 +9,28 @@ https://docs.djangoproject.com/en/3.2/topics/settings/
|
|
For the full list of settings and their values, see
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+import datetime
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
import sys
|
|
import sys
|
|
import os
|
|
import os
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
-import apps.user.middleware.authentication
|
|
|
|
|
|
+# import apps.user.middleware.authentication
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
|
|
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
|
|
|
|
|
|
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
|
|
+MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
|
|
+SOFTWARE_ROOT = "static/software/"
|
|
|
|
+PLAN_ROOT = "static/plan-statement/"
|
|
|
|
+TASK_ROOT = 'static/task-statement/'
|
|
|
|
+CASE_TEMPLATE_ROOT = 'static/case-template/测试用例模版.xlsx'
|
|
|
|
+CASE_FILE_ROOT = 'static/case-file/'
|
|
|
|
+CASE_FILE_EXPORT = 'static/case-file-export/'
|
|
|
|
+HTTP_HEAD = 'http://127.0.0.1:8003/'
|
|
|
|
+
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
|
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
|
@@ -33,9 +41,11 @@ SECRET_KEY = 'django-insecure-zo64fvv02msf-se7!dek5*w$17#3nh6zta#!i=79bt9d#f88@i
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
DEBUG = True
|
|
|
|
|
|
-ALLOWED_HOSTS = []
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ALLOWED_HOSTS = ['*']
|
|
|
|
+# AUTH_USER_MODEL = "user.User"
|
|
|
|
+# AUTHENTICATION_BACKENDS = (
|
|
|
|
+# 'user.middleware.authentication.CustomBackend',
|
|
|
|
+# )
|
|
# Application definition
|
|
# Application definition
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
INSTALLED_APPS = [
|
|
@@ -47,10 +57,13 @@ INSTALLED_APPS = [
|
|
'django.contrib.messages',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'rest_framework',
|
|
|
|
+ 'corsheaders',
|
|
'user',
|
|
'user',
|
|
'software',
|
|
'software',
|
|
- 'test_plan',
|
|
|
|
- 'apps.test_task'
|
|
|
|
|
|
+ 'plan',
|
|
|
|
+ 'apps.task',
|
|
|
|
+ 'file',
|
|
|
|
+ 'log'
|
|
]
|
|
]
|
|
|
|
|
|
MIDDLEWARE = [
|
|
MIDDLEWARE = [
|
|
@@ -61,9 +74,11 @@ MIDDLEWARE = [
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
+ 'corsheaders.middleware.CorsMiddleware',
|
|
|
|
+ 'django.middleware.common.CommonMiddleware',
|
|
]
|
|
]
|
|
|
|
|
|
-ROOT_URLCONF = 'Test_laboratory.urls'
|
|
|
|
|
|
+ROOT_URLCONF = 'TestLaboratory.urls'
|
|
|
|
|
|
TEMPLATES = [
|
|
TEMPLATES = [
|
|
{
|
|
{
|
|
@@ -81,8 +96,7 @@ TEMPLATES = [
|
|
},
|
|
},
|
|
]
|
|
]
|
|
|
|
|
|
-WSGI_APPLICATION = 'Test_laboratory.wsgi.application'
|
|
|
|
-
|
|
|
|
|
|
+WSGI_APPLICATION = 'TestLaboratory.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# Database
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
|
@@ -96,7 +110,6 @@ DATABASES = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
# Password validation
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
|
|
|
|
|
@@ -115,25 +128,42 @@ AUTH_PASSWORD_VALIDATORS = [
|
|
},
|
|
},
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+REST_FRAMEWORK = {
|
|
|
|
+ 'DEFAULT_PERMISSION_CLASSES': (
|
|
|
|
+ 'rest_framework.permissions.IsAuthenticated'
|
|
|
|
+ ),
|
|
|
|
+ 'DEFAULT_AUTHENTICATION_CLASSES': (
|
|
|
|
+ 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
|
|
|
|
+ 'rest_framework.authentication.BasicAuthentication',
|
|
|
|
+ 'rest_framework.authentication.SessionAuthentication'
|
|
|
|
+ )
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+JWT_AUTH = {
|
|
|
|
+ # 设置token有效时间
|
|
|
|
+ 'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=60 * 60 * 2)
|
|
|
|
+}
|
|
|
|
|
|
# Internationalization
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
|
-TIME_ZONE = 'UTC'
|
|
|
|
|
|
+TIME_ZONE = 'Asia/Shanghai'
|
|
|
|
|
|
USE_I18N = True
|
|
USE_I18N = True
|
|
|
|
|
|
USE_L10N = True
|
|
USE_L10N = True
|
|
|
|
|
|
-USE_TZ = True
|
|
|
|
-
|
|
|
|
|
|
+USE_TZ = False
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_URL = '/static/'
|
|
|
|
+STATICFILES_DIRS = [
|
|
|
|
+ os.path.join(BASE_DIR, "static"),
|
|
|
|
+]
|
|
|
|
|
|
# Default primary key field type
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
|
@@ -143,3 +173,28 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
REST_FRAMEWORK = {
|
|
REST_FRAMEWORK = {
|
|
"DEFAULT_AUTHENTICATION_CLASSES": ["apps.user.middleware.authentication.JwtAutentication"]
|
|
"DEFAULT_AUTHENTICATION_CLASSES": ["apps.user.middleware.authentication.JwtAutentication"]
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+CORS_ALLOW_CREDENTIALS = True
|
|
|
|
+CORS_ORIGIN_ALLOW_ALL = True
|
|
|
|
+
|
|
|
|
+CORS_ALLOW_METHODS = (
|
|
|
|
+ 'GET',
|
|
|
|
+ 'POST',
|
|
|
|
+ 'PUT',
|
|
|
|
+ 'PATCH',
|
|
|
|
+ 'DELETE',
|
|
|
|
+ 'OPTIONS'
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+CORS_ALLOW_HEADERS = (
|
|
|
|
+ 'x-requested-with',
|
|
|
|
+ 'content-type',
|
|
|
|
+ 'accept',
|
|
|
|
+ 'origin',
|
|
|
|
+ 'authorization',
|
|
|
|
+ 'x-csrftoken'
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+"""
|
|
|
|
+python manage.py runserver 172.16.100.180:8000
|
|
|
|
+"""
|