text: """
  Django settings for django_shop project.
  
  Generated by 'django-admin startproject' using Django 2.0.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/2.0/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/2.0/ref/settings/
  """
  import os
  import sys
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  sys.path.append(os.path.join(BASE_DIR,'apps'))
  sys.path.append(os.path.join(BASE_DIR,'extra_apps'))
  sys.path.append(os.path.join(BASE_DIR,'django_shop'))
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = '+@=svd7tatxos5rg+ub396#)bgn+rp&h_)o%%t4ayj6=1k8*%0'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = ["*"]
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'DjangoUeditor',
      'xadmin',
      'crispy_forms',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'goods',
      'trade',
      'user',
      'user_operation',
      'rest_framework',
      'django_filters',
      'coreschema',
      'rest_framework.authtoken',
      'social_django'
  ]
  
  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',
  ]
  
  
  #设置微博的appkey和secretkey
  SOCIAL_AUTH_WEIBO_KEY = '2193972585'
  SOCIAL_AUTH_WEIBO_SECRET = 'f1c17a8615c4caa79d4d957dbae64b40'
  
  
  
  ROOT_URLCONF = 'django_shop.urls'
  CORS_ORIGIN_ALLOW_ALL = True
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, 'templates')]
          ,
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'social_django.context_processors.backends',
                  'social_django.context_processors.login_redirect',
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  
  #微博登陆成功之后所跳转的URL
  SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/index/'
  WSGI_APPLICATION = 'django_shop.wsgi.application'
  
  # Database
  # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.mysql',  # mysql数据库
          'NAME': 'djangoshop', # 数据库的名字
          'USER': 'root', # 数据库的用户名
          'PASSWORD': '123456', # 数据库的密码
          'HOST': '127.0.0.1', # ip地址
          'PORT': '3306', # 数据库的端口号
          "OPTIONS":{"init_command":"SET default_storage_engine=INNODB;"}
  
      }
  }
  
  
  
  # REST_FRAMEWORK = {
  #     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', # page=?
  #     'PAGE_SIZE': 2 # 每页20条
  # }
  
  # Password validation
  # https://docs.djangoproject.com/en/2.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',
      },
  ]
  
  # REST_FRAMEWORK = {
  #     'DEFAULT_AUTHENTICATION_CLASSES': (
  #         'rest_framework.authentication.BasicAuthentication',
  #         'rest_framework.authentication.SessionAuthentication',
  #         'rest_framework_jwt.authentication.JSONWebTokenAuthentication', # 根据token查询用户
  #     )
  # }
  
  # 配置验证的模型
  AUTH_USER_MODEL = 'user.User'
  
  
  # Internationalization
  # https://docs.djangoproject.com/en/2.0/topics/i18n/
  
  LANGUAGE_CODE = 'zh-hans'
  TIME_ZONE = 'Asia/Shanghai'
  USE_I18N = True
  USE_L10N = True
  USE_TZ = False
  
  
  AUTHENTICATION_BACKENDS = [
      'social_core.backends.weibo.WeiboOAuth2',
      'user.views.CustomBackend',
      'django.contrib.auth.backends.ModelBackend',
  ]
  
  
  
  import datetime
  #有效期限
  JWT_AUTH = {
      'JWT_EXPIRATION_DELTA': datetime.timedelta(days=7),    #也可以设置seconds=20
      'JWT_AUTH_HEADER_PREFIX': 'JWT',                       #JWT跟前端保持一致，比如“token”这里设置成JWT
  }
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/2.0/howto/static-files/
  
  # 静态资源
  STATIC_URL = '/static/'
  STATICFILES_DIRS = (
      os.path.join(BASE_DIR, "static"),
  )
  
  # 设置上传文件的路径
  MEDIA_URL="/media/"
  MEDIA_ROOT=os.path.join(BASE_DIR,"media")
  
  #收集静态资源的
  STATIC_ROOT = os.path.join(BASE_DIR, "static/")
  