core.default_settings
Overview
Default Django settings factory for VUEDA applications.
Classes
get_defaults
Get a sane and consistent set of default django settings, dotenv lookup keys & defaults and return them as a dict.
You can put this in your settings modules like so:
# Environs-style adapter:
# from environs import Env
# env = Env()
# env.read_env(str(ROOT_DIR / ".env.local"))
# env.read_env(str(ROOT_DIR / ".env"))
# TOML adapter:
from vueda.core.config import TomlEnv, load_toml
from vueda.core.default_settings import get_defaults
env = TomlEnv({**load_toml(ROOT_DIR / "config.toml"), **load_toml(ROOT_DIR / "config.local.toml")})
locals().update(get_defaults(env))env is an env-like adapter providing __call__, bool, int, float, list, and dj_db_url, among others.
Email is configured through Django's deprecated EMAIL_BACKEND and EMAIL_TIMEOUT settings by default, since EMAIL_BACKEND still works on Django 6.1 and MAILERS doesn't exist before it. Pass use_mailers=True to configure Django 6.1+'s MAILERS setting instead; see the MAILERS migration guide. use_mailers=True raises ImproperlyConfigured on Django < 6.1, since those versions ignore MAILERS and would otherwise silently fall back to Django's default SMTP backend instead of the configured one.
VUEDA_APPS must include vueda.history. VUEDA ships pghistory event models and trigger operations in the migrations of every app that owns a tracked model, so a configuration without the app cannot load the migration graph. Omitting it raises ImproperlyConfigured.
Signature
get_defaults(env, use_mailers)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| env | <class 'vueda.core.default_settings.EnvLike'> | yes | |
| use_mailers | <class 'bool'> | yes |
Source
server/vueda/core/default_settings.py:96
get_production_defaults
Additional settings for production environments, causing env to require things that aren't required in development.
Signature
get_production_defaults(env)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| env | <class 'vueda.core.default_settings.EnvLike'> | yes |
Source
server/vueda/core/default_settings.py:512
Source
server/vueda/core/default_settings.py