|
|
|
@ -11,6 +11,7 @@ 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
|
|
|
|
@ -39,12 +40,14 @@ INSTALLED_APPS = [
|
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
|
'rest_framework',
|
|
|
|
|
'django_filters',
|
|
|
|
|
'corsheaders',
|
|
|
|
|
'app'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
@ -122,7 +125,27 @@ USE_TZ = False
|
|
|
|
|
|
|
|
|
|
STATIC_URL = '/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'
|
|
|
|
|
|
|
|
|
|
# 解决跨域
|
|
|
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
|
|
|
CORS_ALLOW_HEADERS = ["*"]
|
|
|
|
|
|
|
|
|
|
CORS_ORIGIN_WHITELIST = ()
|
|
|
|
|
# 对应的发送的请求的跨域
|
|
|
|
|
CORS_ALLOW_METHODS = (
|
|
|
|
|
'DELETE',
|
|
|
|
|
'GET',
|
|
|
|
|
'OPTIONS',
|
|
|
|
|
'PATCH',
|
|
|
|
|
'POST',
|
|
|
|
|
'PUT',
|
|
|
|
|
'VIEW',
|
|
|
|
|
)
|
|
|
|
|