172 lines
4.6 KiB
Python
172 lines
4.6 KiB
Python
"""
|
|
Django settings for qrtr_services project.
|
|
|
|
Generated by 'django-admin startproject' using Django 2.2.6.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/2.2/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/2.2/ref/settings/
|
|
"""
|
|
|
|
import os
|
|
import smtplib
|
|
|
|
try:
|
|
from .local import *
|
|
except ImportError:
|
|
print("Loading Production Environment!")
|
|
from .production import *
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'rest_framework.authtoken',
|
|
'dj_rest_auth',
|
|
'allauth',
|
|
'allauth.account',
|
|
'allauth.socialaccount',
|
|
'dj_rest_auth.registration',
|
|
'allauth.socialaccount.providers.facebook',
|
|
'allauth.socialaccount.providers.twitter',
|
|
'django.contrib.sites',
|
|
'api',
|
|
'user',
|
|
'connection',
|
|
'qrtr_account',
|
|
'corsheaders',
|
|
'rest_framework_simplejwt.token_blacklist',
|
|
'django_filters',
|
|
'drf_yasg',
|
|
]
|
|
SPECTACULAR_SETTINGS = {
|
|
'SWAGGER_UI_DIST': 'SIDECAR', # shorthand to use the sidecar instead
|
|
'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
|
|
'REDOC_DIST': 'SIDECAR',
|
|
# OTHER SETTINGS
|
|
}
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
SITE_ID = 1
|
|
|
|
|
|
MIDDLEWARE = [
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'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',
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
]
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
CORS_ALLOW_HEADERS = ['*']
|
|
|
|
ROOT_URLCONF = 'core.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'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 = 'core.wsgi.application'
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
|
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
'rest_framework.authentication.BasicAuthentication',
|
|
'rest_framework.authentication.SessionAuthentication',
|
|
'rest_framework.authentication.TokenAuthentication',
|
|
'dj_rest_auth.jwt_auth.JWTCookieAuthentication'
|
|
],
|
|
'DEFAULT_FILTER_BACKENDS': (
|
|
'django_filters.rest_framework.DjangoFilterBackend',
|
|
),
|
|
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
|
|
'DEFAULT_PAGINATION_CLASS': 'core.paginators.UserDefinedSizePagination',
|
|
'PAGE_SIZE': 50
|
|
}
|
|
|
|
REST_USE_JWT = True
|
|
|
|
AUTH_USER_MODEL = 'user.User'
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/2.2/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',
|
|
},
|
|
]
|
|
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = False
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_USE_TLS = True
|
|
EMAIL_HOST = 'smtp.sendgrid.net'
|
|
EMAIL_HOST_PASSWORD = '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'
|
|
EMAIL_HOST_USER = 'apikey'
|
|
EMAIL_PORT = 587 # 587, 25
|
|
DEFAULT_FROM_EMAIL = "no-reply@gillesdev.com" |