125 lines
3.2 KiB
Python
125 lines
3.2 KiB
Python
from pathlib import Path
|
|
|
|
BASE_DIR = Path(__file__).absolute().parent.parent
|
|
SECRET_KEY = '-set-in-settings-py-'
|
|
DEBUG = False
|
|
|
|
ALLOWED_HOSTS = ['-set-in-settings-py-']
|
|
USE_X_FORWARDED_HOST = True
|
|
|
|
STATIC_URL = '/assets/'
|
|
STATIC_ROOT = 'assets'
|
|
STATICFILES_DIRS = (
|
|
BASE_DIR / 'static',
|
|
)
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'web.apps.WebConfig',
|
|
'social_django',
|
|
'debug_toolbar',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
'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',
|
|
'social_django.middleware.SocialAuthExceptionMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'mydata.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',
|
|
'social_django.context_processors.backends',
|
|
'social_django.context_processors.login_redirect',
|
|
'web.context_processors.settings',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'mydata.wsgi.application'
|
|
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': str(BASE_DIR / 'mydata.sqlite3'),
|
|
'TEST': {
|
|
'NAME': str(BASE_DIR / 'mydata-test.sqlite3'),
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
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',
|
|
},
|
|
]
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
'web.oauth.blender.BlenderIdOauth2',
|
|
'web.oauth.blender.BlenderIdToken',
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
)
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/2.0/topics/i18n/
|
|
LANGUAGE_CODE = 'en-us'
|
|
TIME_ZONE = 'UTC'
|
|
USE_I18N = True
|
|
USE_L10N = True
|
|
USE_TZ = True
|
|
|
|
BLENDER_ID = {
|
|
'BASE_URL': 'http://id.local:8001/',
|
|
}
|
|
|
|
BLENDER_OPENDATA = {
|
|
'BASE_URL': 'http://opendata.local:8002/',
|
|
'TOKEN': '-set-in-config-py-',
|
|
}
|
|
|
|
LOGIN_URL = 'auth/login'
|
|
LOGOUT_URL = 'auth/logout'
|
|
LOGIN_REDIRECT_URL = 'index'
|
|
AUTH_USER_MODEL = 'web.MydataUser'
|
|
|
|
# Social Auth
|
|
KEY = '-set-in-config-py-'
|
|
SECRET = '-set-in-config-py-'
|
|
SCOPE = ['email']
|
|
USER_FIELDS = ['username', 'email', 'blender_id']
|
|
SOCIAL_AUTH_POSTGRES_JSONFIELD = True
|