# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import datetime import os import sys # Load local settings overrides from pgperffarm.settings_local import * """ Django settings for pgperfarm project. Generated by 'django-admin startproject' using Django 1.8.11. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # 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.insert(0, BASE_DIR) sys.path.insert(0, os.path.join(BASE_DIR, 'apps')) sys.path.insert(0, os.path.join(BASE_DIR, 'extra_apps')) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '35lixc=ebz)1q)u2e7_jj*2#34$t3=7m^&5&-1-2#6=f=nw4-+' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'corsheaders', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_gravatar', 'rest_framework', 'rest_framework.authtoken', 'django_filters', 'users', 'test_records', 'crispy_forms', 'user_operation', 'asynchronous_send_mail' ) MIDDLEWARE_CLASSES = ( 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'pgperffarm.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['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', ], }, }, ] # PASSWORD_HASHERS = ( # 'django.contrib.auth.hashers.MD5PasswordHasher', # 'django.contrib.auth.hashers.PBKDF2PasswordHasher', # 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', # 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher', # 'django.contrib.auth.hashers.BCryptPasswordHasher', # 'django.contrib.auth.hashers.SHA1PasswordHasher', # # 'django.contrib.auth.hashers.CryptPasswordHasher', # ) WSGI_APPLICATION = 'pgperffarm.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases # DATABASES = { # 'default': { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # } # } # Internationalization # https://docs.djangoproject.com/en/1.8/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/1.8/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ "static/", ] AUTHENTICATION_BACKENDS = ( 'users.views.CustomBackend', ) AUTH_USER_MODEL = 'users.UserProfile' REST_FRAMEWORK = { # 'DEFAULT_PERMISSION_CLASSES': ( # 'rest_framework.permissions.IsAuthenticated', # ), # 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), # 'EXCEPTION_HANDLER': ( # 'dataAPI.common.api_exception.custom_exception_handler' # ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', # 'rest_framework.authentication.TokenAuthentication', ), 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 20 } AVATAR_URL = 'http://s.gravatar.com/avatar/' DB_ENUM = { "general_switch": { "on": 1, "off": 2 }, "mode": { "simple": 1, "other": 2 }, "machine_state": { "prohibited": -1, "pending": 0, "active": 1, }, "status": { "none": -1, "improved": 1, "quo": 2, "regressive": 3 } } APPEND_SLAS = False CORS_ALLOW_CREDENTIALS = True CORS_ORIGIN_ALLOW_ALL = True CORS_ORIGIN_WHITELIST = ( '*' ) CORS_ALLOW_METHODS = ( 'DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'VIEW', ) CORS_ALLOW_HEADERS = ( 'XMLHttpRequest', 'X_FILENAME', 'accept-encoding', 'authorization', 'content-type', 'dnt', 'origin', 'user-agent', 'x-csrftoken', 'x-requested-with', 'Pragma', ) ALLOWED_HOSTS = ['*'] JWT_AUTH = { 'JWT_RESPONSE_PAYLOAD_HANDLER': 'users.jwt_handler.jwt_response_payload_handler', 'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=7200), 'JWT_AUTH_HEADER_PREFIX': 'Token', } EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_SSL = True EMAIL_HOST = 'smtp.163.com' EMAIL_PORT = 465 # EMAIL_HOST_USER = '' # EMAIL_HOST_PASSWORD = '' # individual password DEFAULT_FROM_EMAIL = EMAIL_HOST_USER