123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- """
- Django settings for st_cloud project.
- Generated by 'django-admin startproject' using Django 3.2.7.
- 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
- # Build paths inside the project like this: BASE_DIR / 'subdir'.
- BASE_DIR = Path(__file__).resolve().parent.parent
- MEDIA_ROOT = BASE_DIR / 'upload/'
- DATA_UPLOAD_MAX_MEMORY_SIZE = None
- # 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-h1r^p(6-s&@7u!q(sv%_@97fxv(ikbi7d9p#i9+-o_3&pbpw(j'
- SALT = 'sa0v-038auwmd-r0awvy4-0y4vs9mdy9-aby09384vy-amr9tv8ybsva9v4y'
- FILE_ENCRYPT_IV = 'F9FA3DBC9D8HAFDF'
- # SECURITY WARNING: don't run with utils turned on in production!
- DEBUG = True
- ALLOWED_HOSTS = ['30gz758467.51vip.biz', '127.0.0.1','api.shellmiao.com']
- # Application definition
- INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'rest_framework',
- 'corsheaders',
- 'group',
- 'folder',
- 'file',
- 'account'
- ]
- MIDDLEWARE = [
- 'corsheaders.middleware.CorsMiddleware',
- '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 = 'st_cloud.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 = 'st_cloud.wsgi.application'
- # Database
- # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': BASE_DIR / 'db.sqlite3',
- }
- }
- # Password validation
- # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
- PASSWORD_RESET_TIMEOUT = 360000
- 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 = 'en-us'
- TIME_ZONE = 'UTC'
- USE_I18N = True
- USE_L10N = True
- USE_TZ = True
- # Static files (CSS, JavaScript, Images)
- # https://docs.djangoproject.com/en/3.2/howto/static-files/
- STATIC_URL = '/static/'
- # Default primary key field type
- # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
- DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
- EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
- EMAIL_USE_TLS = True
- EMAIL_HOST = 'smtp.qq.com'
- EMAIL_PORT = 25
- EMAIL_HOST_USER = 'lin-xinyuan@qq.com'
- EMAIL_HOST_PASSWORD = 'terwmysqpvxaeahe'
- DEFAULT_FROM_EMAIL = f'ST网盘 <{EMAIL_HOST_USER}>'
- CORS_ORIGIN_ALLOW_ALL = True
- CORS_ALLOW_CREDENTIALS = True
- # 跨域允许的请求方式,可以使用默认值,默认的请求方式为:
- # from corsheaders.defaults import default_methods
- CORS_ALLOW_METHODS = (
- 'GET',
- 'POST',
- 'PUT',
- 'PATCH',
- 'DELETE',
- 'OPTIONS'
- )
- # 允许跨域的请求头,可以使用默认值,默认的请求头为:
- # from corsheaders.defaults import default_headers
- # CORS_ALLOW_HEADERS = default_headers
- CORS_ALLOW_HEADERS = (
- 'XMLHttpRequest',
- 'X_FILENAME',
- 'accept-encoding',
- 'authorization',
- 'content-type',
- 'dnt',
- 'origin',
- 'user-agent',
- 'x-csrftoken',
- 'x-requested-with',
- 'Pragma',
- )
- # 跨域请求时,是否运行携带cookie,默认为False
- CORS_ALLOW_CREDENTIALS = True
- # 允许所有主机执行跨站点请求,默认为False
- # 如果没设置该参数,则必须设置白名单,运行部分白名单的主机才能执行跨站点请求
- CORS_ORIGIN_ALLOW_ALL = True
|