cnap-cobre/synapse

View on GitHub
backend/global/settings/base.py

Summary

Maintainability
A
0 mins
Test Coverage
"""
Django settings for dms project.
 
Generated by 'django-admin startproject' using Django 2.0.1.
 
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
from .secret import Secret
from .allauth import *
from celery.schedules import crontab
os.environ['HTTPS'] = "on"
 
SITE_ID = 1
 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.abspath(__file__ + '../..'))
)
 
 
# 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 = Secret.SECRET_KEY
 
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
 
ADMINS = ['kevin.dice1@gmail.com']
SERVER_EMAIL = ['noreply@synapse.ksu.edu']
 
ALLOWED_HOSTS = [
'hosted.beocat.ksu.edu',
'hosted.beocat.ksu.edu:10443',
'synapse.ksu.edu',
]
 
CSRF_TRUSTED_ORIGINS = ['synapse.ksu.edu']
 
# Application definition
 
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
 
'apps.profile',
'apps.user',
 
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.dropbox',
'allauth.socialaccount.providers.agave',
'allauth.socialaccount.providers.globus',
'allauth.socialaccount.providers.jupyterhub',
 
'crispy_forms',
'webpack_loader',
'compressor',
'django_gravatar',
 
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
 
'smuggler',
 
'apps.main',
'apps.httpproxy',
'apps.transfer',
]
 
MIDDLEWARE = [
'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',
]
 
ROOT_URLCONF = 'global.urls'
 
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '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',
],
},
},
]
 
WSGI_APPLICATION = 'global.wsgi.application'
 
 
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
 
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
}
}
 
 
# 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',
},
]
 
AUTHENTICATION_BACKENDS = {
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
}
 
 
# 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
 
 
# SPA React Webpack Config
WEBPACK_LOADER = {
'DEFAULT': {
'BUNDLE_DIR_NAME': '../static/',
'STATS_FILE': os.path.join(BASE_DIR, 'stats/stats.json'),
}
}
 
 
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
 
STATIC_URL = '/dj-static/'
STATIC_ROOT = 'static'
 
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media'
 
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
'compressor.finders.CompressorFinder',
)
 
 
CRISPY_TEMPLATE_PACK = 'bootstrap4'
 
 
# API Base URLs for Proxying Requests
API_BASE_URL_AGAVE = 'https://api.tacc.utexas.edu'
API_BASE_URL_DROPBOX = 'https://www.dropbox.com'
API_BASE_URL_DROPBOX_API = 'https://api.dropboxapi.com'
API_BASE_URL_DROPBOX_CONTENT = 'https://content.dropboxapi.com'
API_BASE_URL_GLOBUS = 'https://auth.globus.org'
API_BASE_URL_GLOBUS_TRANSFER = 'https://transfer.api.globusonline.org/v0.10'
API_BASE_URL_GLOBUS_SEARCH = 'https://search.api.globus.org'
 
 
DATA_UPLOAD_MAX_MEMORY_SIZE = 150 * 1024 * 1024
 
# Frontend Assets
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'sass --scss {infile} {outfile}'),
)
COMPRESS_ENABLED = True
 
 
# Rest Framework
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
)
}
 
 
# Celery Configuration
CELERY_BROKER_URL = 'amqp://rabbitmq:5672'
# CELERY_RESULT_BACKEND = 'redis://redis:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_BEAT_SCHEDULE = {
# 'hello' : {
# 'task': 'apps.transfer.tasks.launchBatchTransfers',
# 'schedule': crontab()
# }
}