Utilities

Helpers of the settings modules, which are not settings themselves, e.g. the diagnostics that each environment’s module logs after its overrides. The deployment’s overrides, also in this package, have a page of their own: Overrides.

Helpers of the settings modules, which are not settings themselves.

  • utils: the settings diagnostics that every environment’s module logs, after its overrides. Its functions are re-exported here.

  • overrides: the deployment’s overrides of Django settings. Import it from its own module: it is not re-exported here.

Helpers of the settings modules, which are not settings themselves.

The settings diagnostics that every environment’s module logs, after its overrides.

smarter.settings.utils.utils.default_storage_backend(settings)[source]

Return the backend of the default storage in STORAGES.

Parameters:

settings (Mapping[str, object]) – A settings module’s namespace.

Return type:

str

Returns:

Its dotted path, or unknown when STORAGES has no default.

smarter.settings.utils.utils.log_settings_diagnostics(settings)[source]

Log the platform’s diagnostics, and the settings that every environment shares, outside of manage.py.

Each environment’s module calls it with its globals(), after smarter.settings.utils.overrides.apply_overrides(), so that the log shows the values that Django runs with, the deployment’s overrides included, rather than this module’s. The log entries are named after the caller, the environment’s module, e.g. smarter.settings.prod.

Parameters:

settings (Mapping[str, object]) – The environment’s settings module’s namespace.

Return type:

None

smarter.settings.utils.utils.log_smtp_configuration(settings)[source]

Log the SMTP server that email is sent through, or warn that there is none.

The tool worker (database_unavailable) sends no email, and is given no SMTP credentials, by design (ADR-038), so it doesn’t warn: it confirms, at INFO, that email is disabled there. Called by log_settings_diagnostics(), its log entries are named after the environment’s module, as that function’s are.

Parameters:

settings (Mapping[str, object]) – The environment’s settings module’s namespace.

Return type:

None