Settings#
This page lists every setting that FairDM defines or reads, and the third-party settings that FairDM gives a value and that a portal is expected to change. Each entry gives the name, the type, the default, what the setting does and what it accepts. The settings are grouped by subject, and each group is in alphabetical order. It does not explain how to change a setting, which is in How to override a FairDM setting, or how FairDM builds the settings from layers, which is in Configuration.
Where a default differs between environments, the entry gives one default for production and one for development. Production is the baseline fairdm.setup() builds. Development is the baseline with FairDM’s development override applied, which happens when DJANGO_ENV is development.
Environment variables are listed in their own group at the end. A setting that reads an environment variable names it in its default, and the variable has an entry of its own.
The groups are:
Site and environment#
ADMIN_URL#
Type:
strDefault:
"admin/", fromDJANGO_ADMIN_URLWhat it does: The address the Django administration interface is served at.
Accepts: A URL route without a leading slash and with a trailing slash, such as
"staff/".
ADMINS#
Type:
list[tuple[str, str]]Default:
[("Super User", <DJANGO_SUPERUSER_EMAIL>)]What it does: The people Django emails when a request ends in a server error and
DEBUGis off.Accepts: A list of
(name, email address)pairs.
BASE_DIR#
Type:
pathlib.PathDefault: The
base_dirargument offairdm.setup(), or the directory above the one that holds the portal’s settings moduleWhat it does: The portal’s root directory. FairDM looks here for
stack.env,stack.<environment>.env,templates/,assets/,fixtures/andproject/locale/, and putsstatic/andmedia/here.fairdm.setup()sets it.Accepts: A
Pathto a directory. Pass it throughfairdm.setup(base_dir=...). Assigning it after the call does not move the paths FairDM has already built from it.
DJANGO_ENV#
Type:
strDefault:
"production", from theDJANGO_ENVenvironment variableWhat it does: The name of the environment. It selects the override modules that
fairdm.setup()applies and thestack.<environment>.envfile it reads. FairDM also reads it at start-up: only the valuedevelopmentskips the production-critical checks.Accepts: Any string. A name with no override module gets the production baseline.
fairdm.setup()sets the setting from the environment variable, so set the variable and not the setting.
FAIRDM_APPS#
Type:
list[str]Default: The
appsargument offairdm.setup(), or[]What it does: The portal’s own apps.
INSTALLED_APPSplaces them ahead of FairDM’s apps, so a template or static file in a portal app wins over a FairDM file at the same path.fairdm.setup()sets it.Accepts: A list of app module paths. Pass them through
fairdm.setup(apps=[...]). Assigning the setting after the call does not changeINSTALLED_APPS.
MANAGERS#
Type:
list[tuple[str, str]]Default: The value of
ADMINSWhat it does: The people Django emails about broken links when
BrokenLinkEmailsMiddlewareis installed. FairDM does not install it.Accepts: A list of
(name, email address)pairs.
META_SITE_NAME#
Type:
strDefault: The value of
SITE_NAMEWhat it does: The site name that django-meta writes into the page’s
og:site_nametag.Accepts: Any string.
ROOT_URLCONF#
Type:
strDefault:
"config.urls", fromDJANGO_ROOT_URLCONFWhat it does: The module that holds the portal’s URL patterns.
Accepts: The dotted path of a URLconf module. FairDM’s own patterns are in
fairdm.conf.urls, which a portal’s URLconf can include.
SITE_DOMAIN#
Type:
strDefault:
"", fromDJANGO_SITE_DOMAINWhat it does: The domain the portal answers on. It is the first entry of
ALLOWED_HOSTS, it forms the default sender addresses in Email, and it is passed to templates asconfig.site_domain.Accepts: A host name without a scheme or a path, such as
"portal.example.org". An empty value leavesALLOWED_HOSTSempty unlessDJANGO_ALLOWED_HOSTSnames hosts.
SITE_ID#
Type:
intDefault:
1, fromDJANGO_SITE_IDWhat it does: The primary key of the
Siterow that Django’s sites framework treats as this portal.Accepts: The primary key of an existing
Site.
SITE_NAME#
Type:
strDefault:
"FairDM Demo", fromDJANGO_SITE_NAMEWhat it does: The portal’s name when no name has been saved on the portal identity in the administration interface. It heads the hero on the home page, prefixes email subjects, names the sender of email and is passed to templates as
config.site_name.Accepts: Any string.
WSGI_APPLICATION#
Type:
strorNoneDefault:
NoneWhat it does: Django’s setting for the WSGI application object. FairDM leaves it for the portal to set. The container images start gunicorn with the
WSGI_APPvariable and do not read this setting.Accepts: The dotted path of a WSGI callable, such as
"config.wsgi.application".
Apps, middleware and templates#
CRISPY_ALLOWED_TEMPLATE_PACKS#
Type:
list[str]Default:
["daisyui"]What it does: The form template packs that django-crispy-forms accepts.
Accepts: A list of pack names. FairDM’s forms render with the
daisyuipack, so keep it in the list.
CRISPY_TEMPLATE_PACK#
Type:
strDefault:
"daisyui"What it does: The pack that django-crispy-forms renders forms with.
Accepts: A pack name that is also in
CRISPY_ALLOWED_TEMPLATE_PACKS.
DJANGO_TABLES2_TEMPLATE#
Type:
strDefault:
"django_tables2/bootstrap5-mvp.html"What it does: The template django-tables2 draws tables with, and the template FairDM gives the tables it generates for registered types.
Accepts: A template path.
INSTALLED_APPS#
Type:
list[str]Default: In this order, Django’s admin-related apps and
django.contribapps, the apps inFAIRDM_APPS,fairdmand its own apps, then the third-party apps FairDM needs. Development appendsdjango_browser_reload.What it does: The apps Django loads. The order matters, because Django takes the first template and static file it finds for a path.
Accepts: A list of app module paths or app configuration paths. Name a portal’s apps in
fairdm.setup(apps=[...])so they come before FairDM’s. An app added by assignment after the call comes last and cannot override a FairDM template.
MIDDLEWARE#
Type:
list[str]Default: In this order,
SecurityMiddleware, WhiteNoise, django-cors-headers, sessions, CSRF, authentication,mvp_compliance.middleware.AgreementMiddleware, messages, locale, common, current site, clickjacking, allauth’s account middleware, django-htmx, django-tomselect and django-hijack. Development appendsdjango_browser_reload.middleware.BrowserReloadMiddleware.What it does: The request and response middleware. Security, WhiteNoise and authentication must keep their places, and the agreement middleware must come after authentication.
Accepts: A list of dotted paths. Add a portal’s own middleware by assignment after
fairdm.setup().
TEMPLATES#
Type:
list[dict]Default: One Django template backend with
DIRSset to[BASE_DIR / "templates"]. Its context processors are Django’sauth,messages,i18n,debug,request,media,csrf,tzandstatic, thenfairdm.utils.context_processors.fairdmandmvp.context_processors.mvp_config. Its builtins aredjango.templatetags.i18nandeasy_icons.templatetags.easy_icons.What it does: The template engine configuration. The two FairDM context processors supply
config,identity,theme_options,registry,page_configandjson_configto every template.Accepts: Django’s
TEMPLATESformat. Add a directory withTEMPLATES[0]["DIRS"].insert(0, BASE_DIR / "other")and a context processor by appending toTEMPLATES[0]["OPTIONS"]["context_processors"]. Keep the two FairDM processors.
Page shell and branding#
EASY_ICONS#
Type:
dictDefault: Two sets.
defaultdraws an icon as an<i>tag from themvp.utils.BS5_ICONSpack and maps the names FairDM’s pages ask for, such asadd,edit,delete,project,dataset,sampleandmeasurement, to Bootstrap Icons classes.svgdraws icons from SVG files in aniconsdirectory and maps names such asorcid,rorandspinnerto files.What it does: Maps an icon name to the markup that draws it. Templates and menus ask for icons by name.
Accepts: The format django-easy-icons reads. Add or change a name by assigning an item, such as
EASY_ICONS["default"]["icons"]["flask"] = "bi bi-eyedropper". Replacing the whole dictionary removes the names FairDM’s pages use.
FAIRDM_CONFIG#
Type:
dictDefault: A dictionary with the keys
colors,home,external_links,icon_links,logo,announcement,footer_start,footer_centerandback_to_top_button.What it does: FairDM passes the dictionary to every template as
theme_options. No template that FairDM ships reads it.Accepts: Any dictionary. Changing it affects only the templates that read
theme_options.
MVP_CONFIG#
Type:
dictDefault:
{"brand": {"avatar_resolver": "fairdm.contrib.contributors.utils.helpers.avatar_url"}, "layout": {"sidebar": {"title": "FairDM", "collapse": "icons"}, "navbar": {"end": []}}}What it does: Configures django-mvp’s page shell.
brand.avatar_resolveris the function that returns the image of an avatar. The FairDM function returns the contributor’s 150 by 150 thumbnail for sizes up tomd, the 600 by 600 thumbnail forlgand larger, andNonewhen the contributor has no image.layout.sidebar.titleis the text above the sidebar menu.layout.navbar.endis empty because the sidebar already carries the sign-in and theme controls.Accepts: The format django-mvp reads. Assign items, such as
MVP_CONFIG["layout"]["sidebar"]["title"] = "My Portal". The avatar resolver is a dotted path to a function that takes the object and a size and returns an address orNone.
PAGE_CONFIG#
Type:
dictDefault:
brandwithtextset toSITE_NAME,image_lightset to"img/brand/logo.svg"andicon_lightset to"img/brand/icon.svg".sidebarwithshow_atset toFalseandcollapsibleset toTrue.navbarwithfixedset toFalseandmenu_visible_atset to"lg".actionsholding three links: a theme toggle, a GitHub link to the FairDM repository and a link to/docs/.What it does: Describes the page shell. FairDM passes it to every template as
page_config, with the logo, icon and name saved on the portal identity in the administration interface laid overbrand. FairDM’s sign-in and entrance pages readbrand.text.sidebar.show_atisFalsefor a navbar-only layout or a breakpoint from"sm"to"xxl"to show the sidebar in the page flow.navbar.menu_visible_atapplies only whensidebar.show_atisFalse, andFalsehides the navbar menu.Accepts: A dictionary with the keys above. Assign items so the other keys stay, such as
PAGE_CONFIG["actions"] = []to remove the three default links.
Home page#
HOME_PAGE_CONFIG#
Type:
dictDefault: Not set. A key you leave out keeps the value in the table below, which comes from
FairDMHomeView.hero_defaults.What it does: The words and picture of the hero on the landing page that visitors who have not signed in see. Home page describes the page.
Accepts: A dictionary with any of these keys.
Key |
Default |
What it does and what it accepts |
|---|---|---|
|
|
The short line above the title. A string, or |
|
|
The page heading. A string, or |
|
A sentence about FAIR research data |
The sentence under the title. A string, or |
|
|
A background picture. A path under your static files, a path that starts with |
|
|
Whether the portal logo shows above the title. It is drawn only when there is no |
eyebrow, title and lead may contain {site_name}. It is replaced by the name saved on the portal identity, or by SITE_NAME when none has been saved.
PORTAL_DESCRIPTION#
Type:
strDefault: Not set, read as
""What it does: The paragraph in the about section of the landing page. The description saved on the portal identity in the administration interface takes its place once one exists. FairDM also passes it to templates as
config.portal_description.Accepts: Plain text.
Language and time#
FIXTURE_DIRS#
Type:
tuple[str, ...]Default:
(str(BASE_DIR / "fixtures"),)What it does: The directories Django searches for fixture files, in addition to each app’s
fixturesdirectory.Accepts: A tuple or list of directory paths.
LANGUAGE_CODE#
Type:
strDefault:
"en"What it does: The language used when no other is chosen.
Accepts: A language code that is in
LANGUAGES.
LANGUAGES#
Type:
list[tuple[str, str]]Default: Not set by FairDM, so Django’s default list applies
What it does: The languages the portal offers. FairDM reads it to check that
PARLER_LANGUAGESnames only languages in this list. A mismatch stops the portal withfairdm.E400.Accepts: A list of
(code, name)pairs. If you narrow it, narrowPARLER_LANGUAGESandPARLER_DEFAULT_LANGUAGE_CODEto match. See How to add an environment override module for an example.
LOCALE_PATHS#
Type:
list[str]Default:
[str(BASE_DIR / "project" / "locale")]What it does: The directories Django searches for translation files, ahead of each app’s own.
Accepts: A list of directory paths.
PARLER_DEFAULT_LANGUAGE_CODE#
Type:
strDefault:
"en"What it does: The language django-parler uses for translated fields when no other applies.
Accepts: A code that is in
LANGUAGES.
PARLER_LANGUAGES#
Type:
dictDefault: Site
1offersen,frandde, and thedefaultkey holds{"fallback": "en", "hide_untranslated": False}.What it does: The languages that translated fields on FairDM models can hold, per site.
Accepts: The format django-parler reads. Every code, and the
defaultfallback, must be inLANGUAGESor have a code inLANGUAGESas its base, such asfr-cawithfr. Otherwise the portal stops withfairdm.E400.
TIME_ZONE#
Type:
strDefault:
"UTC", fromDJANGO_TIME_ZONEWhat it does: The time zone Django shows times in.
Accepts: A name from the IANA time zone database, such as
"Europe/London".CELERY_TIMEZONEreads the same variable whenfairdm.setup()runs, so assigningTIME_ZONEafterwards does not change it. SetDJANGO_TIME_ZONEto change both.
USE_I18N#
Type:
boolDefault:
TrueWhat it does: Turns Django’s translation system on.
Accepts:
TrueorFalse.
USE_L10N#
Type:
boolDefault:
TrueWhat it does: FairDM sets it. Django 6 does not read it, because it always localises formats.
Accepts:
TrueorFalse, with no effect.
USE_TZ#
Type:
boolDefault:
TrueWhat it does: Stores times in UTC and converts them for display.
Accepts:
True. FairDM’s models assume it.
Security and hosts#
ALLOWED_HOSTS#
Type:
list[str]Default: Production:
DJANGO_SITE_DOMAINfollowed by each host inDJANGO_ALLOWED_HOSTS, leaving out empty entries, so[]when both are unset. Development:["*"].What it does: The host names the portal answers to. An empty list stops a production portal with
fairdm.E003, and a list holding"*"stops it withfairdm.E004.Accepts: A list of host names. Set
DJANGO_ALLOWED_HOSTSto a comma-separated list for more than the site domain.
CSRF_TRUSTED_ORIGINS#
Type:
list[str]Default:
https://followed by each entry ofALLOWED_HOSTSWhat it does: The origins Django accepts for requests that carry a CSRF token from another origin.
Accepts: A list of origins with a scheme, such as
"https://portal.example.org". The list is built fromALLOWED_HOSTSwhenfairdm.setup()runs, so extend it if you add hosts afterwards.
DEBUG#
Type:
boolDefault: Production:
False, fromDJANGO_DEBUG. Development:True, whateverDJANGO_DEBUGsays.What it does: Turns Django’s debug pages on. A production portal with
DEBUGon stops withfairdm.E005.Accepts:
TrueorFalse.
INTERNAL_IPS#
Type:
list[str]Default: For each address of the machine, the same address with its last number replaced by
1What it does: The addresses that see debug-only tools.
Accepts: A list of IP addresses.
SECRET_KEY#
Type:
strDefault: Production:
"", fromDJANGO_SECRET_KEY. Development:"django-insecure-dev-key-CHANGE-THIS-IN-PRODUCTION"when the variable is unset.What it does: The key Django signs sessions, tokens and cookies with. FairDM ships no working key for production. A production portal stops with
fairdm.E001when the key is empty, starts withdjango-insecure-or is shorter than 50 characters.Accepts: A private random string of 50 characters or more. Never commit it. Set
DJANGO_SECRET_KEY.
SECURE_BROWSER_XSS_FILTER#
Type:
boolDefault:
TrueWhat it does: FairDM sets it. Django 6 does not read it.
Accepts:
TrueorFalse, with no effect.
SECURE_CONTENT_TYPE_NOSNIFF#
Type:
boolDefault:
True, fromDJANGO_SECURE_CONTENT_TYPE_NOSNIFFWhat it does: Sends
X-Content-Type-Options: nosniff.Accepts:
TrueorFalse.
SECURE_HSTS_INCLUDE_SUBDOMAINS#
Type:
boolDefault: Production:
True, fromDJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS. Development:False.What it does: Adds
includeSubDomainsto the HSTS header.Accepts:
TrueorFalse.
SECURE_HSTS_PRELOAD#
Type:
boolDefault: Production:
True, fromDJANGO_SECURE_HSTS_PRELOAD. Development:False.What it does: Adds
preloadto the HSTS header.Accepts:
TrueorFalse.
SECURE_HSTS_SECONDS#
Type:
intDefault: Production:
60. Development:0.What it does: How long, in seconds, a browser remembers to use HTTPS only. The production value is low so that a mistake lasts a minute. Raise it once HTTPS works.
Accepts: A number of seconds.
0turns HSTS off.
SECURE_PROXY_SSL_HEADER#
Type:
tuple[str, str]Default:
("HTTP_X_FORWARDED_PROTO", "https")What it does: Tells Django which request header carries the original scheme when a proxy ends TLS. With the default, a request without
X-Forwarded-Proto: httpscounts as plain HTTP and is redirected.Accepts: A
(header, value)pair, orNonewhen no proxy sits in front of the portal.
SECURE_SSL_REDIRECT#
Type:
boolDefault: Production:
True, fromDJANGO_SECURE_SSL_REDIRECT. Development:False.What it does: Redirects plain HTTP requests to HTTPS.
Accepts:
TrueorFalse.
X_FRAME_OPTIONS#
Type:
strDefault:
"DENY"What it does: Stops other sites from showing a portal page in a frame.
Accepts:
"DENY"or"SAMEORIGIN".
Database#
BACKUP_PUBLIC_KEY#
Type:
strDefault:
"", from the environment variable of the same nameWhat it does: The public key every backup is encrypted to. With it set, each database and media backup is written as a
.gpgfile that only the holder of the private key reads. With it empty, backups are written unencrypted, which a development portal accepts. A production portal with it empty stops withfairdm.E700, and with a value that cannot encrypt withfairdm.E701. FairDM trusts this key for the length of a backup, so the key needs no signing or trusting on the server.Accepts: An armoured OpenPGP public key, the text between
-----BEGIN PGP PUBLIC KEY BLOCK-----and-----END PGP PUBLIC KEY BLOCK-----. In an env file it is one line with\nin place of each line break, because an env file holds one variable on each line. A real environment variable, or a Composeenvironment:entry, may hold it on several lines. A private key is refused. See How to back up a portal.
DATABASES#
Type:
dictDefault: One
defaultdatabase built by django-environ. It readsDATABASE_URLwhen set, and otherwise composes a URL fromPOSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_HOST,POSTGRES_PORTandPOSTGRES_DB. The engine is alwaysdjango.contrib.gis.db.backends.postgis, whatever scheme the URL names.ATOMIC_REQUESTSisTrueandCONN_MAX_AGEis60, from the variable of that name.What it does: The portal’s database connection. FairDM runs only on PostgreSQL with the PostGIS extension. A production portal with another engine stops with
fairdm.E101, with no database withfairdm.E100, and with no database name withfairdm.E102.Accepts: The format Django reads. Change a connection option by assigning an item, such as
DATABASES["default"]["OPTIONS"] = {"sslmode": "require"}.
DBBACKUP_CLEANUP_KEEP#
Type:
intDefault:
4, fromBACKUP_KEEPWhat it does: How many database backups django-dbbackup keeps. Each backup removes the oldest beyond this count.
Accepts: A whole number.
DBBACKUP_CLEANUP_KEEP_MEDIA#
Type:
intDefault:
4, fromBACKUP_KEEPWhat it does: How many media backups django-dbbackup keeps. It counts media backups on their own, apart from database backups.
Accepts: A whole number.
DBBACKUP_CONNECTORS#
Type:
dictDefault:
{"default": {"CONNECTOR": "dbbackup.db.postgresql.PgDumpBinaryConnector"}}What it does: How django-dbbackup dumps and restores the database. The connector writes PostgreSQL’s custom format, which is already compressed and which
pg_restorerestores, PostGIS included, into an empty database.Accepts: The format django-dbbackup reads.
DBBACKUP_FILENAME_TEMPLATE#
Type:
strDefault:
"{databasename}-{servername}-{datetime}.{extension}"What it does: The file name of a database backup.
Accepts: A template with the placeholders django-dbbackup defines.
DBBACKUP_HOSTNAME#
Type:
strDefault:
"fairdm", fromBACKUP_SERVER_NAMEWhat it does: The server name in the file name of a backup.
Accepts: A name without spaces.
DBBACKUP_MEDIA_FILENAME_TEMPLATE#
Type:
strDefault:
"{databasename}_media-{servername}-{datetime}.{extension}"What it does: The file name of a media backup.
Accepts: A template with the placeholders django-dbbackup defines.
Note
django-dbbackup 5 refuses the two storage settings of the 4.x series, so FairDM no longer sets them. A portal that sets either moves its choice to STORAGES["dbbackup"], described under STORAGES.
DEFAULT_AUTO_FIELD#
Type:
strDefault:
"django.db.models.BigAutoField"What it does: The type of the automatic primary key on models that declare none.
Accepts: The dotted path of an auto field class.
GDAL_LIBRARY_PATH#
Type:
strorNoneDefault:
None, or the value of the variable of the same name when it is not emptyWhat it does: Where GeoDjango finds the GDAL library.
Nonekeeps Django’s search of the system library path.Accepts: The path of the GDAL shared library. Needed only where GDAL is not on the system library path. The container images need no value.
GEOS_LIBRARY_PATH#
Type:
strorNoneDefault:
None, or the value of the variable of the same name when it is not emptyWhat it does: Where GeoDjango finds the GEOS library.
Accepts: The path of the GEOS shared library. Needed only where GEOS is not on the system library path.
Cache#
CACHES#
Type:
dictDefault: Production: one alias,
default, adjango_redis.cache.RedisCachewhoseLOCATIONisREDIS_URL, with theDefaultClientandIGNORE_EXCEPTIONSset toTrue. WhenREDIS_URLis unset the location is the placeholderredis://unconfigured.invalid:6379/0. Development withoutREDIS_URL: Django’s in-processLocMemCache.What it does: The portal’s caches. They also hold the API and sign-in rate counts, so a production portal needs a cache shared by all its processes. A production portal without one stops with
fairdm.E200.Accepts: The format Django reads. Keep the
defaultalias. Change one option by assigning an item, such asCACHES["default"]["TIMEOUT"] = 600.
COLLECTFASTA_CACHE#
Type:
strDefault:
"collectfasta"What it does: The cache alias django-collectfasta would use. FairDM does not install collectfasta, so the setting has no effect unless a portal installs it.
Accepts: A cache alias.
COLLECTFASTA_THREADS#
Type:
intDefault:
8What it does: The number of threads django-collectfasta would use. It has no effect unless a portal installs collectfasta.
Accepts: A whole number.
Static and media files#
AWS_ACCESS_KEY_ID#
Type:
strDefault:
"", fromS3_ACCESS_KEY_IDWhat it does: The access key for S3 media storage.
Accepts: An access key. Set
S3_ACCESS_KEY_ID.
AWS_S3_REGION_NAME#
Type:
strDefault:
"", fromS3_REGION_NAMEWhat it does: The region of the S3 bucket.
Accepts: A region name such as
"eu-central-1".
AWS_SECRET_ACCESS_KEY#
Type:
strDefault:
"", fromS3_SECRET_ACCESS_KEYWhat it does: The secret key for S3 media storage.
Accepts: A secret key. Set
S3_SECRET_ACCESS_KEYand keep it out of the repository.
AWS_STORAGE_BUCKET_NAME#
Type:
strDefault:
"", fromS3_BUCKET_NAMEWhat it does: The S3 bucket that holds the media files.
Accepts: A bucket name.
DATA_UPLOAD_MAX_MEMORY_SIZE#
Type:
intDefault:
5242880, which is 5 MiBWhat it does: The most request body Django reads into memory before it refuses the request. It does not limit file uploads.
Accepts: A number of bytes, or
Nonefor no limit.
MEDIA_ROOT#
Type:
strDefault:
str(BASE_DIR / "media")What it does: The directory uploaded files are written to when media storage is the local file system. A production portal serves static files itself but not
MEDIA_URL, so serve this directory from the proxy or use S3 storage.Accepts: An absolute directory path.
MEDIA_URL#
Type:
strDefault:
"/media/"What it does: The address that media files are served from. FairDM serves it only when
DEBUGis on.Accepts: A path that ends in a slash, or a full address.
STATIC_ROOT#
Type:
strDefault:
str(BASE_DIR / "static")What it does: The directory
collectstaticwrites to and WhiteNoise serves from.Accepts: An absolute directory path.
STATIC_URL#
Type:
strDefault:
"/static/"What it does: The address that static files are served from.
Accepts: A path that ends in a slash.
STATICFILES_DIRS#
Type:
list[str]Default:
[str(BASE_DIR / "assets")]whenBASE_DIR / "assets"exists asfairdm.setup()runs. Otherwise the setting is not defined.What it does: Extra directories
collectstatictakes files from.Accepts: A list of directory paths.
STATICFILES_FINDERS#
Type:
list[str]Default: The file system finder and the app directories finder
What it does: How Django finds static files.
Accepts: A list of finder dotted paths.
STORAGES#
Type:
dictDefault: Production:
defaultisFileSystemStorageatBASE_DIR / "media", andstaticfilesiswhitenoise.storage.CompressedStaticFilesStorage. WhenS3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEYandS3_BUCKET_NAMEare all set,defaultisstorages.backends.s3boto3.S3Boto3Storage. Development: Django’s plain file storage for both, and no S3.dbbackupisFileSystemStorageat the directory inBACKUP_DIR, or atBASE_DIR / "backups"whenBACKUP_DIRis empty. When the threeS3_*variables are set,dbbackupisS3Boto3Storagein the bucketBACKUP_S3_BUCKET_NAME, or inS3_BUCKET_NAMEwhen that is empty, under the locationbackups.What it does: The storage for uploaded files (
default), collected static files (staticfiles) and backups (dbbackup). FairDM does not compress or fingerprint static files.Accepts: The format Django reads. Add a storage by assigning an item, such as
STORAGES["exports"] = {...}. Replace where backups go by assigningSTORAGES["dbbackup"]. TheBACKUP_DIRcontainer image variable sets the directory the container writes backups to; see Container images. Backups kept on local disk are lost with the server, and production reportsfairdm.W700for them.
THUMBNAIL_ALIASES#
Type:
dictDefault: For all models,
core_small(600 by 400, smart crop) andcore_large(1200 by 800, smart crop). For thecontributorsapp,thumb(48 by 48),small(150 by 150) andmedium(600 by 600), all without cropping.What it does: The named thumbnail sizes that FairDM’s templates ask for.
Accepts: The format easy-thumbnails reads. Add an alias by assigning an item. Replacing the dictionary removes the sizes FairDM’s pages use.
THUMBNAIL_CACHE_DIMENSIONS#
Type:
boolDefault:
TrueWhat it does: Caches the dimensions of thumbnails in the database.
Accepts:
TrueorFalse.
THUMBNAIL_DEBUG#
Type:
boolDefault: Production:
False. Development:True.What it does: When on, easy-thumbnails raises an error for a missing source file and the page returns a 500. When off, it shows a blank image.
Accepts:
TrueorFalse.
THUMBNAIL_PROCESSORS#
Type:
list[str]Default: The colourspace, autocrop, scale-and-crop and filters processors of easy-thumbnails
What it does: The steps that make a thumbnail.
Accepts: A list of processor dotted paths.
THUMBNAIL_SUBDIR#
Type:
strDefault:
"thumbs"What it does: The directory, beside each source image, that holds its thumbnails.
Accepts: A directory name.
THUMBNAIL_WIDGET_OPTIONS#
Type:
dictDefault:
{"size": (150, 100)}What it does: The size of the preview that easy-thumbnails’ image widget shows.
Accepts: A dictionary with a
sizepair.
WHITENOISE_MANIFEST_STRICT#
Type:
boolDefault:
FalseWhat it does: WhiteNoise’s setting for a missing manifest entry. FairDM does not use a manifest storage, so the setting changes nothing unless a portal does.
Accepts:
TrueorFalse.
Background tasks#
The Celery settings use the CELERY_ prefix, which FairDM’s Celery application reads through app.config_from_object("django.conf:settings", namespace="CELERY").
CELERY_ACCEPT_CONTENT#
Type:
list[str]Default:
["json"]What it does: The content types a worker accepts.
Accepts: A list of Celery content types.
CELERY_BEAT_SCHEDULER#
Type:
strDefault:
"django_celery_beat.schedulers:DatabaseScheduler"What it does: The scheduler Celery beat uses, so schedules are stored in the database.
Accepts: The dotted path of a scheduler.
CELERY_BROKER_URL#
Type:
strDefault:
"", fromREDIS_URLWhat it does: The message broker. A portal without one stops
check --deploywithfairdm.E300.Accepts: A broker URL such as
"redis://redis:6379/0". The setting takes its value whenfairdm.setup()runs. SetREDIS_URLand not the setting, or also reassignCELERY_RESULT_BACKEND.
CELERY_RESULT_BACKEND#
Type:
strDefault: The value of
CELERY_BROKER_URLWhat it does: Where task results are stored.
Accepts: A result backend URL.
CELERY_RESULT_BACKEND_ALWAYS_RETRY#
Type:
boolDefault:
TrueWhat it does: Retries reading a result when the backend raises an error that can be retried.
Accepts:
TrueorFalse.
CELERY_RESULT_BACKEND_MAX_RETRIES#
Type:
intDefault:
10What it does: The most retries of a result backend operation.
Accepts: A whole number.
CELERY_RESULT_EXTENDED#
Type:
boolDefault:
TrueWhat it does: Stores the task name, arguments and worker with each result.
Accepts:
TrueorFalse.
CELERY_RESULT_SERIALIZER#
Type:
strDefault:
"json"What it does: How results are encoded.
Accepts: A serializer name that is in
CELERY_ACCEPT_CONTENT.
CELERY_TASK_ALWAYS_EAGER#
Type:
boolDefault: Production:
False. Development withREDIS_URLunset:True.What it does: Runs tasks in the calling process, with no worker.
check --deployreportsTrueasfairdm.E301.Accepts:
TrueorFalse.
CELERY_TASK_EAGER_PROPAGATES#
Type:
boolDefault:
TrueWhat it does: Raises an exception from an eager task in the caller.
Accepts:
TrueorFalse.
CELERY_TASK_SEND_SENT_EVENT#
Type:
boolDefault:
TrueWhat it does: Sends an event when a task is sent, so monitoring tools can track it.
Accepts:
TrueorFalse.
CELERY_TASK_SERIALIZER#
Type:
strDefault:
"json"What it does: How task arguments are encoded.
Accepts: A serializer name that is in
CELERY_ACCEPT_CONTENT.
CELERY_TASK_SOFT_TIME_LIMIT#
Type:
intDefault:
60What it does: Seconds after which a task receives a soft time limit exception.
Accepts: A number of seconds.
CELERY_TASK_TIME_LIMIT#
Type:
intDefault:
300What it does: Seconds after which a worker kills a task.
Accepts: A number of seconds.
CELERY_TIMEZONE#
Type:
strDefault:
"UTC", fromDJANGO_TIME_ZONEWhat it does: The time zone Celery uses for schedules.
Accepts: A name from the IANA time zone database.
CELERY_WORKER_SEND_TASK_EVENTS#
Type:
boolDefault:
TrueWhat it does: Makes workers send events that monitoring tools read.
Accepts:
TrueorFalse.
Email#
DEFAULT_FROM_EMAIL#
Type:
strDefault:
"<SITE_NAME> <noreply@<SITE_DOMAIN>>". WhenDJANGO_DEFAULT_FROM_EMAILis set, its value replacesnoreply@<SITE_DOMAIN>.What it does: The sender of email the portal sends to people.
Accepts: An address, or a name and address in the form
"Name <address>".
EMAIL_BACKEND#
Type:
strDefault: Production:
"django.core.mail.backends.smtp.EmailBackend", from the variable of that name. Development:"django.core.mail.backends.console.EmailBackend", which prints email to the console.What it does: The class that sends email.
Accepts: The dotted path of an email backend.
EMAIL_HOST#
Type:
strDefault:
"", from the variable of that nameWhat it does: The SMTP server. A portal sends no email in production until this is set.
Accepts: A host name.
EMAIL_HOST_PASSWORD#
Type:
strDefault:
"", from the variable of that nameWhat it does: The password for the SMTP server.
Accepts: A password. Keep it out of the repository.
EMAIL_HOST_USER#
Type:
strDefault:
"", from the variable of that nameWhat it does: The user name for the SMTP server.
Accepts: A user name.
EMAIL_PORT#
Type:
intDefault:
587, from the variable of that nameWhat it does: The SMTP port.
Accepts: A port number.
EMAIL_SUBJECT_PREFIX#
Type:
strDefault:
"[<SITE_NAME>]", or"[<SITE_DOMAIN>]"when the site name is emptyWhat it does: The text Django puts before the subject of email it sends to
ADMINSandMANAGERS.Accepts: Any string.
EMAIL_TIMEOUT#
Type:
intDefault:
5What it does: Seconds to wait for the SMTP server.
Accepts: A number of seconds.
EMAIL_USE_TLS#
Type:
boolDefault:
True, from the variable of that nameWhat it does: Starts TLS on the SMTP connection, which suits port 587.
Accepts:
TrueorFalse. For a server that expects TLS from the first byte, usually on port 465, setEMAIL_USE_TLStoFalseand Django’sEMAIL_USE_SSLtoTrue. FairDM does not setEMAIL_USE_SSL.
SERVER_EMAIL#
Type:
strDefault:
"<SITE_NAME> Server <server@<SITE_DOMAIN>>". WhenDJANGO_SERVER_EMAILis set, its value replacesserver@<SITE_DOMAIN>.What it does: The sender of error email to
ADMINS.Accepts: An address, or a name and address in the form
"Name <address>".
Authentication and sign-in#
ACCOUNT_ADAPTER#
Type:
strDefault:
"fairdm.contrib.contributors.adapters.AccountAdapter"What it does: The allauth adapter. It opens signup only while the
allow_signupdjango-waffle switch is on, and then either when the visitor’s email is verified or whenFAIRDM_INVITATION_ONLY_SIGNUPisFalse.Accepts: The dotted path of a subclass of the FairDM adapter.
ACCOUNT_ALLOW_REGISTRATION#
Type:
boolDefault:
TrueWhat it does: Whether the portal offers account creation. When
False, the home page drops its create-account links and asks visitors to sign in. FairDM passes it to templates asconfig.allow_registration.Accepts:
TrueorFalse. To close self-service signup for good, see FAIRDM_INVITATION_ONLY_SIGNUP and How to close self-service signup.
ACCOUNT_CONFIRM_EMAIL_ON_GET#
Type:
boolDefault:
TrueWhat it does: Confirms an email address when the person opens the link, with no extra button.
Accepts:
TrueorFalse.
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS#
Type:
intDefault:
3What it does: How many days an email confirmation link works.
Accepts: A whole number of days.
ACCOUNT_EMAIL_VERIFICATION#
Type:
strDefault: Production:
"mandatory". Development:"none".What it does: Whether a person must confirm their email address before signing in. FairDM claims an unclaimed profile when its email is confirmed, and only while this is
"mandatory".Accepts:
"mandatory","optional"or"none". Only"mandatory"claims profiles by email.
ACCOUNT_FORMS#
Type:
dict[str, str]Default:
loginisfairdm.contrib.contributors.forms.account.LoginFormandsignupisfairdm.contrib.contributors.forms.account.SignupForm.What it does: The allauth forms FairDM replaces.
Accepts: allauth’s format. Subclass the FairDM form, so its fields stay.
ACCOUNT_LOGIN_METHODS#
Type:
set[str]Default:
{"email"}What it does: How a person signs in. People sign in with their email address.
Accepts: allauth’s format.
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION#
Type:
boolDefault:
TrueWhat it does: Signs a person in when they confirm their email address.
Accepts:
TrueorFalse.
ACCOUNT_LOGOUT_ON_GET#
Type:
boolDefault:
FalseWhat it does: Whether a plain link signs a person out. The default requires a form post.
Accepts:
TrueorFalse.
ACCOUNT_MAX_EMAIL_ADDRESSES#
Type:
intDefault:
4What it does: The most email addresses one account may hold.
Accepts: A whole number.
ACCOUNT_SIGNUP_FIELDS#
Type:
list[str]Default:
["email*", "password1*", "password2*"]What it does: The fields on the signup form. A trailing
*marks a required field.Accepts: allauth’s format.
ACCOUNT_SIGNUP_FORM_CLASS#
Type:
strDefault:
"fairdm.contrib.contributors.forms.person.SignupExtraForm"What it does: A form whose extra fields are added to the signup form.
Accepts: The dotted path of a form class.
ACCOUNT_USER_MODEL_EMAIL_FIELD#
Type:
strDefault: Not set by FairDM. FairDM reads it as
"email"when it is absent.What it does: The name of the email field on the user model. FairDM reads it when it matches a person to an email address.
Accepts: A field name.
ACCOUNT_USER_MODEL_USERNAME_FIELD#
Type:
strorNoneDefault:
NoneWhat it does: Tells allauth that the person model has no user name field.
Accepts:
None. A person is identified by email.
AUTH_PASSWORD_VALIDATORS#
Type:
list[dict]Default: Django’s four validators: user attribute similarity, minimum length, common passwords and numeric passwords
What it does: The rules a new password must pass.
Accepts: Django’s format. Add a validator by appending to the list.
AUTH_USER_MODEL#
Type:
strDefault:
"contributors.Person"What it does: The person record is the account, so FairDM has no separate user model.
fairdm.setup()sets it. Do not set it again.Accepts:
"contributors.Person".
AUTHENTICATION_BACKENDS#
Type:
list[str]Default: In this order, Django’s
ModelBackend, allauth’s backend,fairdm.core.permissions.PolymorphicObjectPermissionBackend,fairdm.contrib.contributors.permissions.OrganizationPermissionBackend,fairdm.contrib.contributors.permissions.RecordLevelBackendandfairdm.permissions.PortalRolePermissionBackend.What it does: The classes that authenticate people and answer permission questions. The FairDM backends decide who may open and edit a record.
Accepts: A list of dotted paths. Keep the FairDM backends. Add a backend by appending to the list. Do not add django-guardian’s own backend, because FairDM’s polymorphic backend replaces it.
FAIRDM_INVITATION_ONLY_SIGNUP#
Type:
boolDefault:
FalseWhat it does: When
True, self-service signup is closed and administrators create accounts. A visitor whose session already holds a verified email address can still sign up. Profile claiming works either way: a person holding a valid claim link can still claim their profile.Accepts:
TrueorFalse. Theallow_signupdjango-waffle switch must also be on for any signup to open.
LOGIN_REDIRECT_URL#
Type:
strDefault:
"/"What it does: Where a person goes after signing in when no other page was asked for.
Accepts: A path or a URL name.
LOGIN_URL#
Type:
strDefault:
"account_login"What it does: The page that asks a person to sign in.
Accepts: A path or a URL name.
PASSWORD_HASHERS#
Type:
list[str]Default: Argon2, then PBKDF2, PBKDF2 with SHA1 and bcrypt with SHA256
What it does: The algorithms that hash passwords. The first one hashes new passwords, and the rest are accepted for existing ones.
Accepts: A list of hasher dotted paths.
SILENCED_SYSTEM_CHECKS#
Type:
list[str]Default:
["guardian.W001"]What it does: Check ids Django does not report. FairDM silences
guardian.W001, because the check cannot see the FairDM subclasses of guardian’s backend.Accepts: A list of check ids. Extend it by appending, and keep
guardian.W001. Silencing a check in a report does not stop a production-critical check at start-up.
Profiles and claiming#
CLAIM_TOKEN_MAX_AGE#
Type:
intDefault:
604800, which is seven days. FairDM reads it withgetattr, so the setting is absent unless a portal sets it.What it does: How long, in seconds, a claim link works. An older token is refused with “Claim token has expired.”
Accepts: A number of seconds. See Profile claiming.
CLAIM_TOKEN_SALT#
Type:
strDefault:
"fairdm.contributor.claim". FairDM reads it withgetattr, so the setting is absent unless a portal sets it.What it does: The salt that signs claim tokens. A different salt makes every token issued under the old one invalid.
Accepts: Any string. Changing it in production invalidates the claim links already sent.
FAIRDM_PROFILE_FORMS#
Type:
dict[str, str]Default:
{"person": "fairdm.contrib.contributors.forms.profile.PersonProfileForm", "organization": "fairdm.contrib.contributors.forms.profile.OrganizationProfileForm"}What it does: The form each kind of profile is edited with.
Accepts: A dictionary with the keys
personandorganization, each a dotted path to a form class. A kind left out keeps the shipped form. See How to customise the profile form.
Records and content#
ALLOWED_HTML_ATTRIBUTES#
Type:
listDefault:
[]What it does: FairDM defines it. FairDM’s markdown rendering does not read it and sanitises with the default rules of nh3. See How markdown is sanitised.
Accepts: A list, with no effect on FairDM’s rendering.
ALLOWED_URL_SCHEMES#
Type:
list[str]Default:
["https"]What it does: FairDM defines it. FairDM’s markdown rendering does not read it.
Accepts: A list, with no effect on FairDM’s rendering.
EXPORT_FORMATS#
Type:
list[type]Default: Not set by FairDM. Read as the value of
IMPORT_EXPORT_FORMATSwhen absent.What it does: The formats the export pages offer. Only formats that can export are offered.
Accepts: A list of django-import-export format classes. FairDM reads it when
fairdm.contrib.import_export.utilsis first imported.
FAIRDM_ALLOWED_IDENTIFIERS#
Type:
dict[str, dict[str, str]]Default: Schemes grouped by model: for
samples.Sample,IGSN; forcontributors.Person,ORCID; forcontributors.Organization,ROR,GRID,Wikidata,ISNIandCrossref Funder ID. Each maps the scheme name to its base address, such as"ROR": "https://ror.org/".What it does: The identifier schemes FairDM offers. FairDM combines the inner dictionaries of every model into one list of schemes and does not read the outer keys.
Accepts: The same shape. Add a scheme by assigning an item to the inner dictionary of a model, such as
FAIRDM_ALLOWED_IDENTIFIERS["samples.Sample"]["IGSN"]. FairDM reads the setting whenfairdm.utils.choicesis first imported, so set it before then and not in an app that loads later.
FAIRDM_DATASET#
Type:
dictDefault:
{"keyword_vocabularies": []}What it does: FairDM defines it and no FairDM code reads it, so changing it has no effect.
Accepts: A dictionary, with no effect.
FAIRDM_DEFAULT_LICENSE#
Type:
strDefault:
"CC BY 4.0"What it does: The name of the licence a new dataset starts with, and the licence FairDM’s dataset factory uses. FairDM reads it when a form or factory needs it, so a change applies at once.
Accepts: The
nameof aLicenserow.python manage.py seed_licensescreatesCC0 1.0,CC BY 4.0andCC BY-SA 4.0. If no licence has the name, a new dataset starts with none.
FAIRDM_FACTORIES#
Type:
dict[str, str]Default: Not set. The demo portal sets
{}. Read as{}when absent.What it does: The factories that
python manage.py generate_fake_datauses to create samples and measurements of your own types. Without entries the command skips samples and measurements.Accepts: A dictionary of the model label to the dotted path of its factory, such as
{"myapp.RockSample": "myapp.factories.RockSampleFactory"}. See Management commands.
FAIRDM_MARKDOWN_EXTENSIONS#
Type:
list[str]Default:
["markdown.extensions.extra", "markdown.extensions.nl2br", "markdown.extensions.smarty", "markdown.extensions.sane_lists", "pymdownx.magiclink", "pymdownx.tilde"]What it does: The Python-Markdown extensions applied when markdown is rendered. The
safe_markdownfilter and the editor’s live preview both read it, so a change applies to both. Adding an extension does not widen what the sanitiser keeps.Accepts: A list of Python-Markdown extension names. Extend it with
FAIRDM_MARKDOWN_EXTENSIONS = [*FAIRDM_MARKDOWN_EXTENSIONS, "pymdownx.tasklist"]. See How to render markdown in a template.
FAIRDM_PROJECT#
Type:
dictDefault:
{"keywords": []}What it does: The
keywordskey lists the vocabularies that get a keyword filter on the project list. Each becomes a filter namedkeywords_followed by the last part of the vocabulary’s address. Without any, the list offers one generickeywordsfilter across all vocabularies.Accepts: A dictionary with a
keywordslist of the addresses of loaded vocabularies, such as"https://vocab.example.org/science-keywords". Keep the setting defined, because FairDM reads it without a fallback. See How to filter projects by vocabulary keywords.
IMPORT_EXPORT_FORMATS#
Type:
list[type]Default: FairDM’s
LaTexformat followed by django-import-export’s default formatsWhat it does: The formats FairDM offers for import and export, unless
IMPORT_FORMATSorEXPORT_FORMATSnarrows them.Accepts: A list of django-import-export format classes.
IMPORT_FORMATS#
Type:
list[type]Default: CSV, TSV, XLS, XLSX and ODS
What it does: The formats FairDM accepts for import. Only formats that can import are offered.
Accepts: A list of django-import-export format classes.
CORS_ALLOW_ALL_ORIGINS#
Type:
boolDefault:
TrueWhat it does: Lets a page on any website call the API. Credentials stay off, so a browser never sends the portal’s sign-in cookie from another site, and a caller must send a token.
Accepts:
TrueorFalse. Set it toFalsewithCORS_ALLOWED_ORIGINSto answer only some sites. See How to allow only some sites to call the API.
CORS_ALLOWED_ORIGINS#
Type:
list[str]Default:
[]What it does: The origins that may call the API when
CORS_ALLOW_ALL_ORIGINSisFalse.Accepts: A list of origins with a scheme, such as
"https://app.example.org".
CORS_URLS_REGEX#
Type:
strDefault:
r"^/api/.*$"What it does: The addresses that django-cors-headers answers cross-origin requests for. Only the API is covered.
Accepts: A regular expression matched against the request path.
DEFAULT_THROTTLE_RATES#
A key of REST_FRAMEWORK.
Type:
dict[str, str or None]Default: The API scopes
anon_burstat"30/minute",anon_dayat"2000/day",user_burstat"120/minute"anduser_dayat"20000/day". The four search-box scopes are not in the dictionary. When a scope is missing, the search boxes useautocomplete_anon_burstat"60/minute",autocomplete_anon_dayat"5000/day",autocomplete_user_burstat"240/minute"andautocomplete_user_dayat"50000/day".What it does: How often a caller may use the API. Each kind of caller has a burst limit over a minute and a limit over a day. The search boxes have limits of their own so typing into one does not use an API allowance. How API callers are limited explains the design.
Accepts: For each scope, a string of a number, a slash and
second,minute,hourorday, orNonefor no limit. Change entries and do not replace the dictionary, because the four API scopes must stay. See How to change the API rate limits.
FAIRDM_API_DESCRIPTION#
Type:
strDefault: A Markdown description of the API’s resources, filtering and ordering
What it does: The default that
SPECTACULAR_SETTINGS["DESCRIPTION"]is built from, once, when FairDM loads its API settings.Accepts: Assigning it after
fairdm.setup()has no effect. AssignSPECTACULAR_SETTINGS["DESCRIPTION"]instead.
FAIRDM_API_MAX_PAGE_SIZE#
Type:
intDefault:
1000What it does: The most records a caller may ask for in one page with
?page_size=.FairDMPaginationreads it when it answers a request, so a change applies at once.Accepts: A whole number. See PAGE_SIZE.
FAIRDM_API_TITLE#
Type:
strDefault:
"FairDM Portal API"What it does: The default that
SPECTACULAR_SETTINGS["TITLE"]is built from, once, when FairDM loads its API settings.Accepts: Assigning it after
fairdm.setup()has no effect. AssignSPECTACULAR_SETTINGS["TITLE"]instead.
MVP_ACCOUNTS_API_TOKEN_ACCESS#
Type:
strorNoneDefault: Not set, which lets every signed-in person hold API tokens.
What it does: Names a function that decides who may see and use the API tokens pages. The function takes the signed-in user and returns whether they may. A visitor who is not signed in may never use them, and the function is not asked.
Accepts: A dotted import path to a function, such as
"myportal.access.may_hold_tokens", orNone. A path that does not import raisesImportError. See How to restrict API tokens to some people.
NUM_PROXIES#
A key of REST_FRAMEWORK.
Type:
intorNoneDefault: Not set.
check --deployreportsfairdm.W601while the key is absent.What it does: How many proxies stand between a visitor and the portal. The API and the search boxes use it to read the caller’s address from
X-Forwarded-For, so their limits count the right caller.Accepts: The exact number of proxies,
0for none, orNone. Any value you set ends the warning. See How to count API callers behind a proxy.
PAGE_SIZE#
A key of REST_FRAMEWORK.
Type:
intDefault:
100What it does: How many records a list holds when the caller does not ask for another number.
FairDMPaginationreads it when it answers a request.Accepts: A whole number that is no larger than
FAIRDM_API_MAX_PAGE_SIZE.
REST_FRAMEWORK#
Type:
dictDefault: FairDM sets these keys.
Key |
Default |
|---|---|
|
|
|
|
|
The orjson JSON renderer, then the browsable API renderer |
|
The orjson parser, the form parser and the multipart parser |
|
|
|
|
|
|
|
|
|
|
|
|
What it does: The Django REST framework configuration for the API. Token authentication comes first because the framework answers with 403 instead of 401 when the first authenticator is session authentication.
Accepts: Django REST framework’s format. Assign items and do not replace the dictionary. FairDM’s classes are the ones that enforce record visibility, limits and paging, so keep them.
REST_KNOX#
Type:
dictDefault:
{"TOKEN_LIMIT_PER_USER": 10, "AUTO_REFRESH": False}What it does: The settings of django-rest-knox, which stores the tokens people create on their account pages.
TOKEN_LIMIT_PER_USERis how many working tokens a person may hold, and at the limit the create page makes none and says so.AUTO_REFRESHis off so a token expires on the day the person chose, however often it is used.Accepts: django-rest-knox’s format. Assign items, such as
REST_KNOX["TOKEN_LIMIT_PER_USER"] = 5.
SPECTACULAR_SETTINGS#
Type:
dictDefault:
TITLEfromFAIRDM_API_TITLE,DESCRIPTIONfromFAIRDM_API_DESCRIPTION,VERSION"1.0.0",SERVE_INCLUDE_SCHEMAFalse,SWAGGER_UI_DISTandSWAGGER_UI_FAVICON_HREF"SIDECAR",SCHEMA_PATH_PREFIXr"/api/v[0-9]+",SORT_OPERATIONSFalse, andPOSTPROCESSING_HOOKSholdingdrf_spectacular.hooks.postprocess_schema_enumsandfairdm.api.schema.describe_api.What it does: Configures the OpenAPI schema and the interactive documentation. The bundled Swagger assets let the documentation work without internet access. The
describe_apihook writes the portal’s authentication, limits and paging into the description from the live settings.Accepts: drf-spectacular’s format. Assign items, such as
SPECTACULAR_SETTINGS["TITLE"] = "My Portal API", and never a new dictionary, which drops the Swagger assets, the path prefix and thedescribe_apihook. See How to customise the API documentation.
Legal documents#
django-mvp-compliance reads these settings. FairDM sets one of them. Legal documents describes the pages, and Who is asked to agree to a legal document explains the rules.
MVP_COMPLIANCE_AGREEMENT_CHECK_INTERVAL#
Type:
intorfloatDefault: Not set by FairDM. The package uses
60.What it does: For how many seconds a finding that nothing is outstanding for a person is remembered in their session, so the check does not run on every request.
Accepts: A number of seconds.
0checks on every request. A value that is not a number is reported asmvp_compliance.E004.
MVP_COMPLIANCE_AGREEMENT_EXEMPT_URLS#
Type:
list[str]Default:
["/hijack/"]What it does: Addresses that a person who has not agreed to a required document can still reach. FairDM exempts
/hijack/so an administrator acting as that person can go back to their own account. Each entry covers its path and everything beneath it.Accepts: A list of paths. A string is rejected as
mvp_compliance.E003. Add to the list and do not replace it, such asMVP_COMPLIANCE_AGREEMENT_EXEMPT_URLS += ["/help/"].
MVP_COMPLIANCE_AGREEMENT_EXEMPT_USERS#
Type:
list[str]Default: Not set by FairDM. The package uses
[].What it does: User names that are never asked to agree.
Accepts: A list of user names. A string is rejected as
mvp_compliance.E003.
MVP_COMPLIANCE_AGREEMENT_REDIRECT_URL#
Type:
strDefault: Not set by FairDM. The package uses
"/".What it does: Where a person goes after agreeing, when they were not on their way to another page.
Accepts: A path or a URL.
MVP_COMPLIANCE_RECORD_IP_ADDRESS#
Type:
boolDefault: Not set by FairDM. The package uses
False.What it does: Records the network address a person agreed from. It is off because the address is personal data.
Accepts:
TrueorFalse.
Logging and monitoring#
LOGGING#
Type:
dictDefault: Production: the root logger writes
INFOand above to the console.django.requesterrors anddjango.security.DisallowedHostgo to the site administrators by email whenDEBUGis off. Development: replaces the whole dictionary with console logging, where thefairdmlogger is atDEBUG,djangoatINFOanddjango.db.backendsatWARNING, and no email.What it does: Django’s logging configuration.
Accepts: Django’s format. Add a logger by assigning an item, such as
LOGGING["loggers"]["my_app"] = {"handlers": ["console"], "level": "INFO"}.
SENTRY_DSN#
Type:
strDefault:
"", from the variable of that nameWhat it does: The Sentry project address. When it is set, FairDM starts the Sentry SDK with the Django, Celery, Redis and logging integrations as
fairdm.setup()runs. When it is empty, Sentry stays off.Accepts: A DSN. Set the variable. Assigning the setting after
fairdm.setup()does not start Sentry.
SENTRY_LOG_LEVEL#
Type:
intDefault:
20(logging.INFO), fromDJANGO_SENTRY_LOG_LEVELWhat it does: The lowest log level the Sentry logging integration records as a breadcrumb. Records at
ERRORand above become events.Accepts: A Python logging level number. Set the variable, because
fairdm.setup()reads it once.
Settings for other packages#
These settings configure packages that FairDM installs. A portal rarely changes them.
ACTSTREAM_SETTINGS#
Type:
dictDefault:
{"USE_JSONFIELD": True}What it does: FairDM defines it. No installed app reads it.
Accepts: A dictionary, with no effect.
GET_SOLO_TEMPLATE_TAG_NAME#
Type:
strDefault:
"site_config"What it does: The name of the template tag that django-solo provides for reading single-row models such as the portal identity.
Accepts: A tag name.
META_SITE_PROTOCOL#
Type:
strDefault:
"https"What it does: The scheme django-meta writes into the page’s meta tags.
Accepts:
"https"or"http".
META_USE_OG_PROPERTIES#
Type:
boolDefault:
TrueWhat it does: Writes Open Graph properties into the page’s meta tags.
Accepts:
TrueorFalse.
META_USE_SITES#
Type:
boolDefault:
TrueWhat it does: Builds meta tag addresses from the sites framework.
Accepts:
TrueorFalse.
META_USE_TITLE_TAG#
Type:
boolDefault:
TrueWhat it does: Writes the page title into the meta tags.
Accepts:
TrueorFalse.
META_USE_TWITTER_PROPERTIES#
Type:
boolDefault:
TrueWhat it does: Writes Twitter card properties into the page’s meta tags.
Accepts:
TrueorFalse.
SOLO_CACHE#
Type:
strDefault:
"default"What it does: The cache alias django-solo stores single-row models in.
Accepts: A key of
CACHES.
SOLO_CACHE_TIMEOUT#
Type:
intDefault:
300What it does: Seconds django-solo keeps a single-row model in the cache.
Accepts: A number of seconds.
WAFFLE_CREATE_MISSING_FLAGS#
Type:
boolDefault:
TrueWhat it does: Makes django-waffle create a flag in the database the first time code asks for one that does not exist.
Accepts:
TrueorFalse.
WAFFLE_CREATE_MISSING_SAMPELS#
Type:
boolDefault:
TrueWhat it does: FairDM defines it under this spelling. django-waffle reads
WAFFLE_CREATE_MISSING_SAMPLES, with an E, so this setting has no effect.Accepts:
TrueorFalse, with no effect.
WAFFLE_CREATE_MISSING_SWITCHES#
Type:
boolDefault:
TrueWhat it does: Makes django-waffle create a switch in the database the first time code asks for one that does not exist.
Accepts:
TrueorFalse.
Environment variables#
fairdm.setup() reads these variables through django-environ. A variable can be set in the process environment, in stack.env, in stack.<environment>.env or in the file named by env_file, in the order Configuration gives. The container images set or read a few more variables of their own.
Three kinds of variable have no entry here. DJANGO_ENV and SENTRY_DSN are described above, because the variable and the setting share a name. The email variables EMAIL_BACKEND, EMAIL_HOST, EMAIL_HOST_PASSWORD, EMAIL_HOST_USER, EMAIL_PORT and EMAIL_USE_TLS are described under the Email setting of the same name. GDAL_LIBRARY_PATH and GEOS_LIBRARY_PATH are described under Database in the same way.
BACKUP_DIR#
Type:
strDefault:
"", which keeps backups inBASE_DIR / "backups". The container images set it to/var/lib/fairdm/backups.What it does: The directory the local
dbbackupstorage inSTORAGESwrites backups to. It has no effect when the media is on S3, because the backups then go to a bucket.Accepts: A directory path the portal can write to.
BACKUP_KEEP#
Type:
intDefault:
4What it does: Sets
DBBACKUP_CLEANUP_KEEPandDBBACKUP_CLEANUP_KEEP_MEDIA, the number of database backups and the number of media backups kept.Accepts: A whole number, 1 or more.
BACKUP_S3_BUCKET_NAME#
Type:
strDefault:
"", which keeps backups in the media bucket,S3_BUCKET_NAMEWhat it does: The S3 bucket backups are written to, under the location
backups. It applies only when the media is on S3. Set it to a bucket of its own: a backup kept in the media bucket is lost with that bucket. With a bucket of its own, the media archive is not affected by the backups, and the bucket can have its own access rules and lifecycle. It uses the same credentials as the media,S3_ACCESS_KEY_IDandS3_SECRET_ACCESS_KEY.Accepts: The name of a bucket the media credentials can read and write.
BACKUP_SERVER_NAME#
Type:
strDefault:
"fairdm"What it does: Sets
DBBACKUP_HOSTNAME, the server name in the file name of a backup.Accepts: A name without spaces.
CONN_MAX_AGE#
Type:
intDefault:
60What it does: Sets
DATABASES["default"]["CONN_MAX_AGE"], the seconds a database connection stays open.Accepts: A number of seconds.
DATABASE_URL#
Type:
strDefault:
"". When it is empty, thePOSTGRES_*variables form the connection.What it does: The database connection for
DATABASES.Accepts: A connection URL such as
"postgresql://user:password@host:5432/name". FairDM opens it with the PostGIS backend whatever the scheme says.
DJANGO_ADMIN_URL#
Type:
strDefault:
"admin/"What it does: Sets
ADMIN_URL.Accepts: A route that ends in a slash.
DJANGO_ALLOWED_HOSTS#
Type:
list[str]Default:
[]What it does: Adds hosts to
ALLOWED_HOSTSbesideDJANGO_SITE_DOMAIN.Accepts: A comma-separated list of host names.
DJANGO_DEBUG#
Type:
boolDefault:
FalseWhat it does: Sets
DEBUGin production. The development override setsDEBUGon whatever the variable says.Accepts:
TrueorFalse.
DJANGO_DEFAULT_FROM_EMAIL#
Type:
strDefault: Unset, so the address is
noreply@<DJANGO_SITE_DOMAIN>What it does: The address part of
DEFAULT_FROM_EMAIL. The site name stays in front of it.Accepts: An email address.
DJANGO_ROOT_URLCONF#
Type:
strDefault:
"config.urls"What it does: Sets
ROOT_URLCONF.Accepts: A dotted module path.
DJANGO_SECRET_KEY#
Type:
strDefault:
"". Development uses an insecure fallback when it is unset.What it does: Sets
SECRET_KEY.Accepts: A private random string of 50 characters or more.
DJANGO_SECURE_CONTENT_TYPE_NOSNIFF#
Type:
boolDefault:
TrueWhat it does: Sets
SECURE_CONTENT_TYPE_NOSNIFF.Accepts:
TrueorFalse.
DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS#
Type:
boolDefault:
TrueWhat it does: Sets
SECURE_HSTS_INCLUDE_SUBDOMAINSin production.Accepts:
TrueorFalse.
DJANGO_SECURE_HSTS_PRELOAD#
Type:
boolDefault:
TrueWhat it does: Sets
SECURE_HSTS_PRELOADin production.Accepts:
TrueorFalse.
DJANGO_SECURE_SSL_REDIRECT#
Type:
boolDefault:
TrueWhat it does: Sets
SECURE_SSL_REDIRECTin production.Accepts:
TrueorFalse.
DJANGO_SENTRY_LOG_LEVEL#
Type:
intDefault:
20What it does: Sets
SENTRY_LOG_LEVEL.Accepts: A Python logging level number.
DJANGO_SERVER_EMAIL#
Type:
strDefault: Unset, so the address is
server@<DJANGO_SITE_DOMAIN>What it does: The address part of
SERVER_EMAIL.Accepts: An email address.
DJANGO_SITE_DOMAIN#
Type:
strDefault:
""What it does: Sets
SITE_DOMAIN.Accepts: A host name.
DJANGO_SITE_ID#
Type:
intDefault:
1What it does: Sets
SITE_ID.Accepts: A whole number.
DJANGO_SITE_NAME#
Type:
strDefault:
"FairDM Demo"What it does: Sets
SITE_NAME.Accepts: Any string.
DJANGO_SUPERUSER_EMAIL#
Type:
strDefault:
"super.user@example.com"What it does: The email address of the first administrator account, and the address in
ADMINS.Accepts: An email address.
DJANGO_SUPERUSER_PASSWORD#
Type:
strDefault:
"". FairDM ships no working password.What it does: The password that Django’s
createsuperuser --no-inputreads for the administrator account.Accepts: A password. Keep it out of the repository.
DJANGO_TIME_ZONE#
Type:
strDefault:
"UTC"What it does: Sets
TIME_ZONEandCELERY_TIMEZONE.Accepts: A name from the IANA time zone database.
ORCID_BASE_DOMAIN#
Type:
strDefault:
"orcid.org"What it does: The ORCID domain that sign-in with ORCID uses, in
SOCIALACCOUNT_PROVIDERS.Accepts:
"orcid.org"for the live service or"sandbox.orcid.org"for ORCID’s sandbox.
POSTGRES_DB#
Type:
strDefault:
""What it does: The database name, used when
DATABASE_URLis empty.Accepts: A database name.
POSTGRES_HOST#
Type:
strDefault:
"postgres"What it does: The database host, used when
DATABASE_URLis empty.Accepts: A host name.
POSTGRES_PASSWORD#
Type:
strDefault:
""What it does: The database password, used when
DATABASE_URLis empty. FairDM quotes it, so special characters are safe.Accepts: A password.
POSTGRES_PORT#
Type:
intDefault:
5432What it does: The database port, used when
DATABASE_URLis empty.Accepts: A port number.
POSTGRES_USER#
Type:
strDefault:
"postgres"What it does: The database user, used when
DATABASE_URLis empty.Accepts: A user name.
REDIS_URL#
Type:
strDefault:
""What it does: The Redis server for both caches in
CACHESand forCELERY_BROKER_URL. In production it must be set. In development, leaving it unset holds every cache in memory and runs tasks in the calling process.Accepts: A Redis URL such as
"redis://redis:6379/0".
S3_ACCESS_KEY_ID#
Type:
strDefault:
""What it does: Sets
AWS_ACCESS_KEY_ID. Media storage moves to S3 when this,S3_SECRET_ACCESS_KEYandS3_BUCKET_NAMEare all set.Accepts: An access key.
S3_BUCKET_NAME#
Type:
strDefault:
""What it does: Sets
AWS_STORAGE_BUCKET_NAME.Accepts: A bucket name.
S3_REGION_NAME#
Type:
strDefault:
""What it does: Sets
AWS_S3_REGION_NAME.Accepts: A region name.
S3_SECRET_ACCESS_KEY#
Type:
strDefault:
""What it does: Sets
AWS_SECRET_ACCESS_KEY.Accepts: A secret key.
SENTRY_ENVIRONMENT#
Type:
strDefault:
"production"What it does: The environment name Sentry files events under. It applies only when
SENTRY_DSNis set.Accepts: Any string.
SENTRY_TRACES_SAMPLE_RATE#
Type:
floatDefault:
0.0What it does: The share of requests Sentry traces. It applies only when
SENTRY_DSNis set.Accepts: A number from
0.0to1.0.
Variables FairDM declares and does not read#
FairDM declares these variables when it builds the environment reader, and no setting is built from them. Setting them changes nothing.
DJANGO_CACHEDJANGO_READ_DOT_ENV_FILEDJANGO_SECUREDJANGO_SECURE_HSTS_SECONDSFAIRDM_ALLOW_PUBLIC_REGISTRATIONUSE_DOCKER
SOCIALACCOUNT_ADAPTER#Type:
strDefault:
"fairdm.contrib.contributors.adapters.SocialAccountAdapter"What it does: The allauth adapter for social sign-in. It requires the
allow_signupswitch and links a sign-in with ORCID to the profile that holds the same ORCID iD.Accepts: The dotted path of a subclass of the FairDM adapter.