Update references to Django documentation pages

This commit is contained in:
Christopher C. Wells 2022-02-21 15:39:38 -08:00
parent 2f9658d7de
commit 21fa57c9c1
7 changed files with 58 additions and 53 deletions

View File

@ -20,7 +20,7 @@ DEBUG = bool(strtobool(os.environ.get("DEBUG") or "False"))
# Applications
# https://docs.djangoproject.com/en/3.0/ref/applications/
# https://docs.djangoproject.com/en/4.0/ref/applications/
INSTALLED_APPS = [
"api",
@ -46,7 +46,7 @@ INSTALLED_APPS = [
]
# Middleware
# https://docs.djangoproject.com/en/3.0/ref/middleware/
# https://docs.djangoproject.com/en/4.0/ref/middleware/
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
@ -66,13 +66,13 @@ MIDDLEWARE = [
# URL dispatcher
# https://docs.djangoproject.com/en/3.0/topics/http/urls/
# https://docs.djangoproject.com/en/4.0/topics/http/urls/
ROOT_URLCONF = "babybuddy.urls"
# Templates
# https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-TEMPLATES
# https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-TEMPLATES
TEMPLATES = [
{
@ -92,7 +92,7 @@ TEMPLATES = [
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
config = {
"ENGINE": os.getenv("DB_ENGINE") or "django.db.backends.sqlite3",
@ -113,7 +113,7 @@ DATABASES = {"default": config}
# Cache
# https://docs.djangoproject.com/en/3.0/topics/cache/
# https://docs.djangoproject.com/en/4.0/topics/cache/
CACHES = {
"default": {
@ -124,13 +124,13 @@ CACHES = {
# WGSI
# https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
# https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
WSGI_APPLICATION = "babybuddy.wsgi.application"
# Authentication
# https://docs.djangoproject.com/en/3.0/topics/auth/default/
# https://docs.djangoproject.com/en/4.0/topics/auth/default/
AUTHENTICATION_BACKENDS = [
"axes.backends.AxesBackend",
@ -145,14 +145,14 @@ LOGOUT_REDIRECT_URL = "babybuddy:login"
# Timezone
# https://docs.djangoproject.com/en/3.0/topics/i18n/timezones/
# https://docs.djangoproject.com/en/4.0/topics/i18n/timezones/
USE_TZ = True
TIME_ZONE = os.environ.get("TIME_ZONE") or "UTC"
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
# https://docs.djangoproject.com/en/4.0/topics/i18n/
USE_I18N = True
@ -180,7 +180,7 @@ LANGUAGES = [
# Format localization
# https://docs.djangoproject.com/en/3.0/topics/i18n/formatting/
# https://docs.djangoproject.com/en/4.0/topics/i18n/formatting/
USE_L10N = True
@ -196,7 +196,7 @@ USE_24_HOUR_TIME_FORMAT = bool(
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# https://docs.djangoproject.com/en/4.0/howto/static-files/
# http://whitenoise.evans.io/en/stable/django.html
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
@ -214,7 +214,7 @@ WHITENOISE_ROOT = os.path.join(BASE_DIR, "static", "babybuddy", "root")
# Media files (User uploaded content)
# https://docs.djangoproject.com/en/3.0/topics/files/
# https://docs.djangoproject.com/en/4.0/topics/files/
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
@ -232,20 +232,21 @@ if AWS_STORAGE_BUCKET_NAME:
# Security
# https://docs.djangoproject.com/en/3.2/ref/settings/#secure-proxy-ssl-header
# https://docs.djangoproject.com/en/4.0/ref/settings/#secure-proxy-ssl-header
if os.environ.get("SECURE_PROXY_SSL_HEADER"):
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# https://docs.djangoproject.com/en/3.2/topics/http/sessions/#settings
# https://docs.djangoproject.com/en/4.0/topics/http/sessions/#settings
SESSION_COOKIE_HTTPONLY = True
# SESSION_COOKIE_SECURE = True
# https://docs.djangoproject.com/en/3.2/ref/csrf/#settings
# https://docs.djangoproject.com/en/4.0/ref/csrf/#settings
CSRF_COOKIE_HTTPONLY = True
# CSRF_COOKIE_SECURE = True
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS", []).split(",")
# https://docs.djangoproject.com/en/3.2/topics/auth/passwords/
# https://docs.djangoproject.com/en/4.0/topics/auth/passwords/
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
@ -302,12 +303,12 @@ AXES_FAILURE_LIMIT = 5
# Session configuration
# Used by RollingSessionMiddleware to determine how often to reset the session.
# See https://docs.djangoproject.com/en/3.0/topics/http/sessions/
# See https://docs.djangoproject.com/en/4.0/topics/http/sessions/
ROLLING_SESSION_REFRESH = 86400
# Set default auto field for models.
# See https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys
# See https://docs.djangoproject.com/en/4.0/releases/3.2/#customizing-type-of-auto-created-primary-keys
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

View File

@ -4,6 +4,6 @@ SECRET_KEY = "CISECRETKEYIGUESS"
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"

View File

@ -1,14 +1,14 @@
from .base import *
# Quick-start development settings - unsuitable for production
# https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
SECRET_KEY = "CHANGE ME"
DEBUG = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# https://docs.djangoproject.com/en/4.0/howto/static-files/
#
# Comment out STATICFILES_STORAGE and uncomment DEBUG = False to test with
# production static files.

View File

@ -11,13 +11,13 @@ BABY_BUDDY["ALLOW_UPLOADS"] = bool(
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
# Email
# https://docs.djangoproject.com/en/3.0/topics/email/
# https://docs.djangoproject.com/en/4.0/topics/email/
# https://devcenter.heroku.com/articles/sendgrid#python
SENDGRID_USERNAME = os.environ.get("SENDGRID_USERNAME", None) # noqa: F405

View File

@ -8,7 +8,7 @@ SECRET_KEY = ""
ALLOWED_HOSTS = [""]
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": {
@ -18,7 +18,7 @@ DATABASES = {
}
# Media files
# https://docs.djangoproject.com/en/3.0/topics/files/
# https://docs.djangoproject.com/en/4.0/topics/files/
MEDIA_ROOT = os.path.join(BASE_DIR, "../data/media")
@ -26,8 +26,8 @@ MEDIA_ROOT = os.path.join(BASE_DIR, "../data/media")
# After setting up SSL, uncomment the settings below for enhanced security of
# application cookies.
#
# See https://docs.djangoproject.com/en/3.2/topics/http/sessions/#settings
# See https://docs.djangoproject.com/en/3.2/ref/csrf/#settings
# See https://docs.djangoproject.com/en/4.0/topics/http/sessions/#settings
# See https://docs.djangoproject.com/en/4.0/ref/csrf/#settings
# SESSION_COOKIE_SECURE = True
# CSRF_COOKIE_SECURE = True

View File

@ -3,8 +3,8 @@ from .base import *
SECRET_KEY = "TESTS"
# Password hasher configuration
# See https://docs.djangoproject.com/en/3.2/ref/settings/#password-hashers
# See https://docs.djangoproject.com/en/3.2/topics/testing/overview/#password-hashing
# See https://docs.djangoproject.com/en/4.0/ref/settings/#password-hashers
# See https://docs.djangoproject.com/en/4.0/topics/testing/overview/#password-hashing
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",

View File

@ -5,25 +5,6 @@ Baby Buddy will check the application directory structure for an `.env` file or
take these variables from the system environment. **System environment variables
take precedence over the contents of an `.env` file.**
- [`ALLOWED_HOSTS`](#allowed_hosts)
- [`ALLOW_UPLOADS`](#allow_uploads)
- [`AWS_ACCESS_KEY_ID`](#aws_access_key_id)
- [`AWS_SECRET_ACCESS_KEY`](#aws_secret_access_key)
- [`AWS_STORAGE_BUCKET_NAME`](#aws_storage_bucket_name)
- [`DEBUG`](#debug)
- [`NAP_START_MAX`](#nap_start_max)
- [`NAP_START_MIN`](#nap_start_min)
- [`DB_ENGINE`](#db_engine)
- [`DB_HOST`](#db_host)
- [`DB_NAME`](#db_name)
- [`DB_PASSWORD`](#db_password)
- [`DB_PORT`](#db_port)
- [`DB_USER`](#db_user)
- [`SECRET_KEY`](#secret_key)
- [`SECURE_PROXY_SSL_HEADER`](#secure_proxy_ssl_header)
- [`TIME_ZONE`](#time_zone)
- [`USE_24_HOUR_TIME_FORMAT`](#use_24_hour_time_format)
## `ALLOWED_HOSTS`
*Default: * (any)*
@ -31,7 +12,7 @@ take precedence over the contents of an `.env` file.**
Set this variable to a single host or comma-separated list of hosts without spaces.
This should *always* be set to a specific host or hosts in production deployments.
See also: [Django's documentation on the ALLOWED_HOSTS setting](https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts)
See also: [Django's documentation on the ALLOWED_HOSTS setting](https://docs.djangoproject.com/en/4.0/ref/settings/#allowed-hosts)
## `ALLOW_UPLOADS`
@ -83,7 +64,7 @@ and the [`SECURE_PROXY_SSL_HEADER`](#secure_proxy_ssl_header) environment variab
The database engine utilized for the deployment.
See also [Django's documentation on the ENGINE setting](https://docs.djangoproject.com/en/3.0/ref/settings/#engine).
See also [Django's documentation on the ENGINE setting](https://docs.djangoproject.com/en/4.0/ref/settings/#engine).
## `DB_HOST`
@ -116,6 +97,29 @@ The listening port for the database. The default port is 5432 for PostgreSQL.
The database username utilized for the deployment.
## `DEBUG`
*Default: False*
When in debug mode, Baby Buddy will print much more detailed error information
for exceptions. This setting should be *False* in production deployments.
See also [Django's documentation on the DEBUG setting](https://docs.djangoproject.com/en/4.0/ref/settings/#debug).
## `NAP_START_MAX`
*Default: 18:00*
The maximum nap *start* time (in the instance's time zone). Expects the 24-hour
format %H:%M.
## `NAP_START_MIN`
*Default: 06:00*
The minimum nap *start* time (in the instance's time zone). Expects the 24-hour
format %H:%M.
## `SECRET_KEY`
*Default: None*
@ -123,7 +127,7 @@ The database username utilized for the deployment.
A random, unique string must be set as the "secret key" before Baby Buddy can
be deployed and run.
See also [Django's documentation on the SECRET_KEY setting](https://docs.djangoproject.com/en/3.0/ref/settings/#secret-key).
See also [Django's documentation on the SECRET_KEY setting](https://docs.djangoproject.com/en/4.0/ref/settings/#secret-key).
## `SECURE_PROXY_SSL_HEADER`
@ -137,7 +141,7 @@ came in via HTTPS).
:warning: Modifying this setting can compromise Baby Buddys security. Ensure
you fully understand your setup before changing it.
See also [Django's documentation on the SECURE_PROXY_SSL_HEADER setting](https://docs.djangoproject.com/en/3.0/ref/settings/#secure-proxy-ssl-header).
See also [Django's documentation on the SECURE_PROXY_SSL_HEADER setting](https://docs.djangoproject.com/en/4.0/ref/settings/#secure-proxy-ssl-header).
## `TIME_ZONE`