|
|
|
@ -10,44 +10,26 @@ For the full list of settings and their values, see
|
|
|
|
|
https://docs.djangoproject.com/en/dev/ref/settings/
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from redis import ConnectionPool
|
|
|
|
|
import os
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
import sentry_sdk
|
|
|
|
|
from decouple import config, Csv
|
|
|
|
|
from dj_database_url import parse as db_url
|
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
import os
|
|
|
|
|
from django.urls import reverse_lazy
|
|
|
|
|
|
|
|
|
|
import sentry_sdk
|
|
|
|
|
from redis import ConnectionPool
|
|
|
|
|
from sentry_sdk.integrations.django import DjangoIntegration
|
|
|
|
|
|
|
|
|
|
SENTRY_DSN = config('SENTRY_DSN', None)
|
|
|
|
|
if SENTRY_DSN:
|
|
|
|
|
sentry_sdk.init(
|
|
|
|
|
dsn=SENTRY_DSN,
|
|
|
|
|
integrations=[DjangoIntegration()],
|
|
|
|
|
|
|
|
|
|
# Set traces_sample_rate to 1.0 to capture 100%
|
|
|
|
|
# of transactions for performance monitoring.
|
|
|
|
|
# We recommend adjusting this value in production,
|
|
|
|
|
traces_sample_rate=1.0,
|
|
|
|
|
|
|
|
|
|
# If you wish to associate users to errors (assuming you are using
|
|
|
|
|
# django.contrib.auth) you may enable sending PII data.
|
|
|
|
|
send_default_pii=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
|
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
|
|
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
|
SECRET_KEY = config('SECRET_KEY')
|
|
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
|
DEBUG = config('DEBUG', default=False, cast=bool)
|
|
|
|
|
DEBUG_TOOLBAR = config('DEBUG', default=False, cast=bool)
|
|
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='localhost,127.0.0.1', cast=Csv())
|
|
|
|
|
|
|
|
|
@ -85,9 +67,9 @@ INSTALLED_APPS = [
|
|
|
|
|
'corsheaders',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# if DEBUG:
|
|
|
|
|
# INSTALLED_APPS.append('django_extensions')
|
|
|
|
|
# INSTALLED_APPS.append('debug_toolbar')
|
|
|
|
|
if DEBUG and DEBUG_TOOLBAR:
|
|
|
|
|
INSTALLED_APPS.append('django_extensions')
|
|
|
|
|
INSTALLED_APPS.append('debug_toolbar')
|
|
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
|
|
@ -95,7 +77,7 @@ MIDDLEWARE = [
|
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
|
# 'mozilla_django_oidc.middleware.SessionRefresh', TODO: Needs some testing...
|
|
|
|
|
# 'mozilla_django_oidc.middleware.SessionRefresh', TODO: Needs some testing...
|
|
|
|
|
'corsheaders.middleware.CorsPostCsrfMiddleware',
|
|
|
|
|
'hawkrest.middleware.HawkResponseMiddleware',
|
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
@ -104,8 +86,8 @@ MIDDLEWARE = [
|
|
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# if DEBUG:
|
|
|
|
|
# MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
|
|
|
|
|
if DEBUG and DEBUG_TOOLBAR:
|
|
|
|
|
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
|
|
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'VRE.urls'
|
|
|
|
|
|
|
|
|
@ -192,7 +174,7 @@ INTERNAL_IPS = config('INTERNAL_IPS', default='127.0.0.1', cast=Csv())
|
|
|
|
|
# This will tell Django if the request is trough SSL (proxy). This is needed for Hawk authentication
|
|
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
|
|
|
|
|
|
# settings.py
|
|
|
|
|
# Huey task worker settings
|
|
|
|
|
HUEY = {
|
|
|
|
|
'huey_class': 'huey.RedisHuey', # Huey implementation to use.
|
|
|
|
|
'name': DATABASES['default']['NAME'].split('/')[-1], # Use db name for huey.
|
|
|
|
@ -250,8 +232,7 @@ if surfnet_conext_secrets.exists():
|
|
|
|
|
pos = line.find('=')
|
|
|
|
|
os.environ[line[:pos].strip()] = line[pos + 1:].strip()
|
|
|
|
|
|
|
|
|
|
# Surfconext settings
|
|
|
|
|
# Authentication settings
|
|
|
|
|
# SURFconext OIDC authentication settings
|
|
|
|
|
# https://mozilla-django-oidc.readthedocs.io/en/stable/installation.html
|
|
|
|
|
OIDC_RP_CLIENT_ID = config('OIDC_RP_CLIENT_ID')
|
|
|
|
|
OIDC_RP_CLIENT_SECRET = config('OIDC_RP_CLIENT_SECRET')
|
|
|
|
@ -269,6 +250,7 @@ LOGIN_REDIRECT_URL = '/'
|
|
|
|
|
LOGOUT_REDIRECT_URL = '/'
|
|
|
|
|
|
|
|
|
|
# Email settings for sending out upload invitations.
|
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
|
|
|
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='Do not reply<no-reply@rug.nl>')
|
|
|
|
|
EMAIL_HOST = config('EMAIL_HOST', default='')
|
|
|
|
|
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
|
|
|
|
@ -280,9 +262,8 @@ EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool)
|
|
|
|
|
# The code will use a reply-to header to make sure that replies goes to the researcher and not this address
|
|
|
|
|
EMAIL_FROM_ADDRESS = config('EMAIL_FROM_ADDRESS', default='Do not reply<no-reply@rug.nl>')
|
|
|
|
|
|
|
|
|
|
# if DEBUG:
|
|
|
|
|
# EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
|
|
|
|
|
# EMAIL_FILE_PATH = BASE_DIR / 'sent_emails'
|
|
|
|
|
if DEBUG:
|
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
|
|
|
|
|
|
# Study settings
|
|
|
|
|
# Duration of the JWT invite link in seconds. Default is 3 days
|
|
|
|
@ -311,6 +292,25 @@ CORS_ALLOW_HEADERS = config('CORS_ALLOW_HEADERS', default='accept,accept-encodin
|
|
|
|
|
|
|
|
|
|
CORS_EXPOSE_HEADERS = CORS_ALLOW_HEADERS
|
|
|
|
|
|
|
|
|
|
# Sentry settings
|
|
|
|
|
SENTRY_DSN = config('SENTRY_DSN', None)
|
|
|
|
|
if SENTRY_DSN:
|
|
|
|
|
sentry_sdk.init(
|
|
|
|
|
dsn=SENTRY_DSN,
|
|
|
|
|
integrations=[DjangoIntegration()],
|
|
|
|
|
|
|
|
|
|
# Set traces_sample_rate to 1.0 to capture 100%
|
|
|
|
|
# of transactions for performance monitoring.
|
|
|
|
|
# We recommend adjusting this value in production,
|
|
|
|
|
traces_sample_rate=1.0,
|
|
|
|
|
|
|
|
|
|
# If you wish to associate users to errors (assuming you are using
|
|
|
|
|
# django.contrib.auth) you may enable sending PII data.
|
|
|
|
|
send_default_pii=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
#Todo: Logging config
|
|
|
|
|
|
|
|
|
|
# LOGGING = {
|
|
|
|
|
# 'version': 1,
|
|
|
|
|
# 'disable_existing_loggers': False,
|
|
|
|
|