Configuration¶
This section describes any settings which are specific to iarbackend
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 iarbackend.settings.base
module:
-
iarbackend.settings.base.
BASE_DIR
= '/home/travis/build/uisautomation/iar-backend'¶ Base directory containing the project. Build paths inside the project via
os.path.join(BASE_DIR, ...)
.
-
iarbackend.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.
-
iarbackend.settings.base.
DEBUG
= True¶ SECURITY WARNING: don’t run with debug turned on in production!
-
iarbackend.settings.base.
ALLOWED_HOSTS
= []¶ By default, no hosts are allowed.
-
iarbackend.settings.base.
INSTALLED_APPS
= ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'automationcommon', 'ucamwebauth', 'multiselectfield', 'rest_framework', 'drf_yasg', 'django_filters', 'automationlookup', 'assets']¶ Installed applications
-
iarbackend.settings.base.
MIDDLEWARE
= ['corsheaders.middleware.CorsMiddleware', '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', 'automationcommon.middleware.RequestUserMiddleware', 'assets.middleware.LogHttp400Errors']¶ Installed middleware
-
iarbackend.settings.base.
ROOT_URLCONF
= 'iarbackend.urls'¶ Root URL patterns
-
iarbackend.settings.base.
TEMPLATES
= [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/home/travis/build/uisautomation/iar-backend/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']}}]¶ Template loading
-
iarbackend.settings.base.
WSGI_APPLICATION
= 'iarbackend.wsgi.application'¶ WSGI
-
iarbackend.settings.base.
DATABASES
= {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'PASSWORD': 'mysecret', 'HOST': 'localhost', 'USER': 'postgres', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None, 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'NAME': None, 'MIRROR': None}}}¶ 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.
-
iarbackend.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
-
iarbackend.settings.base.
LANGUAGE_CODE
= 'en-gb'¶ Internationalization
-
iarbackend.settings.base.
TIME_ZONE
= 'UTC'¶ Internationalization
-
iarbackend.settings.base.
USE_I18N
= True¶ Internationalization
-
iarbackend.settings.base.
USE_L10N
= True¶ Internationalization
-
iarbackend.settings.base.
USE_TZ
= True¶ Internationalization
-
iarbackend.settings.base.
STATIC_URL
= '/static/'¶ Static files (CSS, JavaScript, Images)
-
iarbackend.settings.base.
AUTHENTICATION_BACKENDS
= ['ucamwebauth.backends.RavenAuthBackend', 'django.contrib.auth.backends.ModelBackend']¶ Authentication backends
-
iarbackend.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.
-
iarbackend.settings.base.
UCAMWEBAUTH_LOGOUT_REDIRECT
= 'https://raven.cam.ac.uk/auth/logout.html'¶ Redirect to this URL on log out
-
iarbackend.settings.base.
UCAMWEBAUTH_NOT_CURRENT
= False¶ Allow members who are not current members to log in?
-
iarbackend.settings.base.
CORS_ORIGIN_ALLOW_ALL
= True¶ By default, whitelist all origins for CORS
-
iarbackend.settings.base.
SWAGGER_SETTINGS
= {'DEFAULT_AUTO_SCHEMA_CLASS': 'assets.inspectors.SwaggerAutoSchema', 'SECURITY_DEFINITIONS': {'oauth2': {'type': 'oauth2', 'description': 'OAuth2 Bearer Token', 'flow': 'implicit', 'authorizationUrl': 'http://oauth2.example.com/oauth2/auth', 'scopes': {'assetregister': 'Read/write access to the asset register'}}}, 'USE_SESSION_AUTH': False}¶ Swagger UI settings