Configuration¶
This section describes any settings which are specific to the Streaming Media Service application.
Specifying the database¶
The default settings.py
file contains a facility to configure the database
by means of environment variables. A variable with a name of the form
DJANGO_DB_<key>
will be used to set the DATABASES['default'][<key>]
setting. So, for example, one could set the location of the sqlite database by
setting the DJANGO_DB_NAME
environment variable or one could change the
backend by setting DJANGO_DB_BACKEND
.
Default settings¶
The default settings are given in the mediawebapp.settings.base
module:
-
mediawebapp.settings.base.
BASE_DIR
= '/usr/src/app'¶ Base directory containing the project. Build paths inside the project via
os.path.join(BASE_DIR, ...)
.
-
mediawebapp.settings.base.
SECRET_KEY
= 'ex561uglj%!8oh*umt3-@2-4yj*&dc8cznob*vmb0!9bryoc-$'¶ The Django secret key is by default set from the environment. If omitted, a system check will complain.
-
mediawebapp.settings.base.
DEBUG
= True¶ SECURITY WARNING: don’t run with debug turned on in production!
-
mediawebapp.settings.base.
ALLOWED_HOSTS
= []¶ By default, no hosts are allowed.
-
mediawebapp.settings.base.
INSTALLED_APPS
= ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'whitenoise.runserver_nostatic', 'django.contrib.staticfiles', 'django.contrib.sites', 'django.contrib.sitemaps', 'automationcommon', 'automationlookup', 'automationoauth', 'corsheaders', 'crispy_forms', 'django_filters', 'drf_yasg', 'rest_framework', 'ucamwebauth', 'robots', 'reversion', 'django_celery_beat', 'django_celery_results', 'rest_framework.authtoken', 'legacysms', 'mediaplatform', 'mediaplatform_jwp', 'ui', 'api', 'oaipmh']¶ Installed applications
-
mediawebapp.settings.base.
MIDDLEWARE
= ['django.middleware.security.SecurityMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'mediawebapp.middleware.user_lookup_middleware', 'reversion.middleware.RevisionMiddleware']¶ Installed middleware
-
mediawebapp.settings.base.
ROOT_URLCONF
= 'mediawebapp.urls'¶ Root URL patterns
-
mediawebapp.settings.base.
TEMPLATES
= [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/usr/src/build/frontend/'], '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']}}]¶ Template loading. We include FRONTEND_APP_BUILD_DIR as a template dir so we can use the frontend index.html as a template.
-
mediawebapp.settings.base.
WSGI_APPLICATION
= 'mediawebapp.wsgi.application'¶ WSGI
-
mediawebapp.settings.base.
DATABASES
= {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql', 'HOST': 'db', 'NAME': 'webapp', 'OPTIONS': {}, 'PASSWORD': 'databasePass', 'PORT': '5432', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'webappuser'}}¶ Database configuration. The default settings allow configuration of the database from environment variables. An environment variable named
DJANGO_DB_<key>
will override theDATABASES['default'][<key>]
setting.
-
mediawebapp.settings.base.
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'}]¶ Password validation
-
mediawebapp.settings.base.
LANGUAGE_CODE
= 'en-us'¶ Internationalization
-
mediawebapp.settings.base.
TIME_ZONE
= 'UTC'¶ Internationalization
-
mediawebapp.settings.base.
USE_I18N
= True¶ Internationalization
-
mediawebapp.settings.base.
USE_L10N
= True¶ Internationalization
-
mediawebapp.settings.base.
USE_TZ
= True¶ Internationalization
-
mediawebapp.settings.base.
STATIC_URL
= '/static/'¶ Static files (CSS, JavaScript, Images)
-
mediawebapp.settings.base.
AUTHENTICATION_BACKENDS
= ['ucamwebauth.backends.RavenAuthBackend', 'django.contrib.auth.backends.ModelBackend']¶ Authentication backends
-
mediawebapp.settings.base.
UCAMWEBAUTH_CREATE_USER
= True¶ Allow the autocreation of users who have been successfully authenticated by Raven but do not exist in the local database.
-
mediawebapp.settings.base.
UCAMWEBAUTH_LOGOUT_REDIRECT
= '/'¶ Redirect to this URL on log out
-
mediawebapp.settings.base.
UCAMWEBAUTH_NOT_CURRENT
= False¶ Allow members who are not current members to log in?
-
mediawebapp.settings.base.
JWPLATFORM_API_KEY
= ''¶ JWPlatform API key. Loaded from the
JWPLATFORM_API_KEY
environment variable.
-
mediawebapp.settings.base.
JWPLATFORM_API_SECRET
= ''¶ JWPlatform API secret. Loaded from the
JWPLATFORM_API_SECRET
environment variable.