Settings

Environment Variable Overview

Most settings are defined by environment variables. They may be set in an .env file in the project’s root directory to adjust various aspects of the deployment.

See their usage details below.

General App Settings

These environment variables are read by the Django app and thus have a corresponding value in Django accessible via django.conf.settings.

Environment Variable

Django Setting

Production Default

Development Default

ACCOUNT_EMAIL_VERIFICATION

DJANGO_EMAIL_VERIFICATION

optional

optional

DATABASE_URL

DATABASES["default"]

DJANGOADMIN_FORCE_ALLAUTH

DJANGO_ADMIN_FORCE_ALLAUTH

False

False

DJANGO_ACCOUNT_ALLOW_REGISTRATION

ACCOUNT_ALLOW_REGISTRATION

True

True

DJANGO_ADMINS

ADMINS

[]

[]

DJANGO_ADMIN_URL

ADMIN_URL

/admin

DJANGO_ALLOWED_HOSTS

ALLOWED_HOSTS

DJANGO_DEBUG_TOOLBAR

DEBUG_TOOLBAR

True

DJANGO_DEBUG

DEBUG

False

True

DJANGO_ENABLE_MFA

ENABLE_MFA

False

False

DJANGO_HOMEPAGE_LINKS

HOMEPAGE_LINKS

DJANGO_SECRET_KEY

SECRET_KEY

DJANGO_SECURE_CONTENT_TYPE_NOSNIFF

SECURE_CONTENT_TYPE_NOSNIFF

True

DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS

SECURE_HSTS_INCLUDE_SUBDOMAINS

True

DJANGO_SECURE_HSTS_PRELOAD

SECURE_HSTS_PRELOAD

True

DJANGO_SECURE_SSL_REDIRECT

SECURE_SSL_REDIRECT

True

DJANGO_SILKY_PYTHON_PROFILER_BINARY

SILKY_PYTHON_PROFILER_BINARY

False

False

DJANGO_SILKY_PYTHON_PROFILER

SILKY_PYTHON_PROFILER

False

False

DJANGO_SOCIAL_LOGIN_ENABLED

SOCIALACCOUNT_ENABLED

True

True

DJANGO_TITLE

TITLE

Tesy's Tagboard

Tesy's Tagboard

USE_DOCKER

yes

yes

Email Settings

Environment Variable

Django Setting

Production Default

Development Default

DJANGO_DEFAULT_FROM_EMAIL

DEFAULT_FROM_EMAIL

DJANGO_EMAIL_BACKEND

EMAIL_BACKEND

django.core.mail.backends.smtp.EmailBackend

django.core.mail.backends.smtp.EmailBackend

DJANGO_EMAIL_HOST_PASSWORD

EMAIL_HOST_PASSWORD

tesys_tagboard_local_mailpit

DJANGO_EMAIL_HOST_USER

EMAIL_HOST_USER

DJANGO_EMAIL_HOST

EMAIL_HOST

tesys_tagboard_local_mailpit

DJANGO_EMAIL_PORT

EMAIL_PORT

1025

DJANGO_SERVER_EMAIL

SERVER_EMAIL

DJANGO_DEFAULT_FROM_EMAIL

Database Settings

Environment Variable

Default

POSTGRES_DB

tesys_tagboard

POSTGRES_PASSWORD

POSTGRES_PORT

5432

POSTGRES_USER

Third-party Authentication

Environment Variable

Django Setting

Production Default

Development Default

DJANGO_DISCORD_CLIENT_ID

DJANGO_DISCORD_CLIENT_SECRET

DJANGO_DISCORD_PUBLIC_KEY

Environment Variable Usage

Detailed descriptions of each environment variable and their intended usage.

ACCOUNT_EMAIL_VERIFICATION

Options

optional (default)

User’s MAY optionally provide an email at signup which may be used for password resets and other notifications.

mandatory

User’s MUST provide an email

none

User’s CANNOT provide an email. This option usually corresponds with an alternative third-party authentication option. Otherwise user’s won’t be able to make accounts at all.

DATABASE_URL

By default, the database URL used by the Django application to communicate with the Postgres database is generated from the Database Settings. This setting will override that generated database URL.

DJANGOADMIN_FORCE_ALLAUTH

TODO

DJANGO_ACCOUNT_ALLOW_REGISTRATION

TODO

DJANGO_ADMINS

TODO

DJANGO_ADMIN_URL

The URL for the admin dashboard. It is recommended to change this from the default value to help prevent authenticaton attacks on the admin dashboard.

DJANGO_ALLOWED_HOSTS

This setting configures the app to accept requests from a list of hosts. When deployed via Docker, this value should not need to be changed from the default. See the relevant Django docs for more details.

DJANGO_DEBUG_TOOLBAR

This a development only setting which enables the Django Debug Toolbar. It has no effect on a production deployment.

DJANGO_DEBUG

This setting enables or disables Django’s Debug Mode which will cause the app to display detailed error messages and additional info about the runtime environment. This setting SHOULD NOT be enabled in a production deployment unless you know what you’re doing.

DJANGO_DEFAULT_FROM_EMAIL

TODO

DJANGO_DISCORD_CLIENT_ID

The client ID for Discord third-party login.

DJANGO_DISCORD_CLIENT_SECRET

The client secret for Discord third-party login.

DJANGO_DISCORD_PUBLIC_KEY

The public key for Discord third-party login.

DJANGO_EMAIL_BACKEND

The email backend used by Django to handle emails. See the Django Email backends documentation for more details.

Options

django.core.mail.backends.smtp.EmailBackend (default)

use the Django SMTP email backend

anymail.backends.mailgun.EmailBackend

use the Anymail Mailgun email backend

anymail.backends.mailtrap.EmailBackend

use the Anymail Mailtrap email backend

Note

Setting either MAILGUN_API_KEY or MAILTRAP_API_TOKEN will automatically override this setting to use the appropriate email backend.

DJANGO_EMAIL_HOST_PASSWORD

The password to use for the SMTP server defined in DJANGO_EMAIL_HOST.

DJANGO_EMAIL_HOST_USER

The username to use for the SMTP server defined in DJANGO_EMAIL_HOST.

DJANGO_EMAIL_HOST

The host used for sending email.

DJANGO_EMAIL_PORT

The port to use for the SMTP server defined in DJANGO_EMAIL_HOST.

DJANGO_ENABLE_MFA

Enables MFA (multifactor authentication).

TODO: describe MFA options

A list describing the default links to display on the homepage. For example the default as of this writing is this:

DJANGO_HOMEPAGE_LINKS=[
    ("Home", "/"),
    ("Posts", "/posts"),
    ("Tags", "/tags"),
    ("Collections", "/collections"),
]

The list must contain a series of lists or tuples with the first and values for each being the link title and the URL respectively.

DJANGO_SECRET_KEY

See the Django docs for details. The application cannot start without setting this variable. Set it to a long alphanumeric string. Preferably, 24 characters or more.

Warning

Failing to keep this value secret could lead to remote code execution and privilege escalation on the host system.

DJANGO_SECURE_CONTENT_TYPE_NOSNIFF

TODO

DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS

TODO

DJANGO_SECURE_HSTS_PRELOAD

TODO

DJANGO_SECURE_SSL_REDIRECT

TODO

DJANGO_SERVER_EMAIL

TODO

DJANGO_SETTINGS_MODULE

TODO

DJANGO_SILKY_PYTHON_PROFILER_BINARY

TODO

DJANGO_SILKY_PYTHON_PROFILER

TODO

DJANGO_SOCIAL_LOGIN_ENABLED

TODO

DJANGO_TITLE

TODO

POSTGRES_DB

TODO

POSTGRES_PASSWORD

TODO

POSTGRES_PORT

TODO

POSTGRES_USER

TODO

USE_DOCKER

TODO