django-settings-expose
A modern, high-performance, and cached Django context processor that safely exposes specific settings to your templates.
This is a heavily optimized drop-in replacement for the unmaintained django-settings-export package.
Unlike the original implementation, django-settings-expose caches your exposed settings in memory at server startup,
introducing zero performance overhead on later template renders.
Features
- ⚡ Zero-overhead: Settings are read and cached once when the server boots.
- 🔒 Secure: Only whitelisted settings in
SETTINGS_EXPOSEare exposed. - 🛑 Fail-fast: Throws clear, descriptive errors during development if you typo a setting name or try to access an unexposed variable in a template.
Installation
Install the package directly from PyPI:
pip install django-settings-expose
Configuration
- Add the context processor to your
settings.pyinside theTEMPLATESconfiguration:
# settings.py
TEMPLATES = [
{
# ...
"OPTIONS": {
"context_processors": [
# ...
# Add this line:
"django_settings_expose.settings_expose",
],
},
},
]
- Define the list of settings you want to expose to your templates using
SETTINGS_EXPOSE:
# settings.py
API_VERSION = "v1.2.6"
COMPANY_NAME = "My Awesome Company"
SECRET_KEY = "super-secret" # Keep this safe!
# Whitelist variables to be accessible in templates
SETTINGS_EXPOSE = [
"API_VERSION",
"COMPANY_NAME",
]
Usage in Templates
All exposed settings are made available via a globally accessible {{ settings }} dictionary variable:
<footer>
<p>Copyright © 2026 {{ settings.COMPANY_NAME }}</p>
<p>API Version: {{ settings.API_VERSION }}</p>
</footer>
Error Handling
To protect you from typos and silent bugs, the library will raise explicit exceptions:
- If a variable listed in
SETTINGS_EXPOSEis missing fromsettings.py, it throws anUndefinedSettingErroron startup. - If a template attempts to access a variable that wasn't whitelisted (e.g.,
{{ settings.SECRET_KEY }}), it throws anUnexposedSettingError.
License & Acknowledgements
This project is licensed under the BSD 3-Clause License.
It is based on the original concept of django-settings-export by Jakub Roztocil <jakub@subtleapps.com> (Copyright ©
2014).
Modified and optimized by Vladimir Klimenko <v.klimenko.2137@gmail.com> (Copyright © 2026).
Metadata
Release files for django-settings-expose 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_settings_expose-0.1.1.tar.gz | 6.0 kB | Without provenance | Details for django_settings_expose-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_settings_expose-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for django_settings_expose-0.1.1-py3-none-any.whl |
Total release size: 11.3 kB
Release files / django_settings_expose-0.1.1.tar.gz
| Download URL | django_settings_expose-0.1.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edcd5ea93f5ec00adc5ebb98f3bddde8743a1b69ddd79a7854aa17acae35f497
|
|
BLAKE2b-256 checksum How to use checksums |
701d118db549885bcda66d1eb33a3e81891991c81f702973b4ff2e3f4a5178cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / django_settings_expose-0.1.1-py3-none-any.whl
| Download URL | django_settings_expose-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8de755b4c764ba86f268570152f6d6466c52505b9b742e9d7ce376dad18bdafe
|
|
BLAKE2b-256 checksum How to use checksums |
8856f8dff3e658fe419f6770e6c493e6636ab3d47ab95ed3116420d1dcc3a252
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for django-settings-expose 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.