61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
from .settings_default import *
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
|
'rest_framework.authentication.BasicAuthentication',
|
|
'rest_framework.authentication.SessionAuthentication',
|
|
),
|
|
'DEFAULT_PERMISSION_CLASSES': [
|
|
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
|
],
|
|
|
|
# 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
|
'DEFAULT_PAGINATION_CLASS': 'core.pagination.PagePaginationWithPageCount',
|
|
'PAGE_SIZE': 10
|
|
}
|
|
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
CORS_ALLOW_CREDENTIALS = True # 允许携带cookie
|
|
# CORS_ALLOW_ALL_ORIGINS = True # If this is used then `CORS_ALLOWED_ORIGINS` will not have any effect
|
|
CORS_ALLOWED_ORIGINS = [
|
|
'http://localhost:8080',
|
|
'http://127.0.0.1:8080',
|
|
'http://192.168.1.101:8080'
|
|
]
|
|
|
|
CORS_ALLOW_METHODS = [
|
|
"DELETE",
|
|
"GET",
|
|
"OPTIONS",
|
|
"PATCH",
|
|
"POST",
|
|
"PUT",
|
|
]
|
|
|
|
CORS_ALLOW_HEADERS = [
|
|
"accept",
|
|
"accept-encoding",
|
|
"authorization",
|
|
"content-type",
|
|
"dnt",
|
|
"origin",
|
|
"user-agent",
|
|
"x-csrftoken",
|
|
"x-requested-with",
|
|
]
|
|
|
|
CORS_ALLOW_HEADERS = ('*')
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
|
|
STATICFILES_DIRS = [
|
|
os.path.join(BASE_DIR, "frontend/dist/"),
|
|
]
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|