App-Parameter is a very simple Django app to save application's parameter in the database.
Project description
Django-app-parameter
Django-app-parameter lets you store application settings in the database and update them at runtime through Django admin - no deployment or restart needed. Perfect for things like site titles, email addresses, feature flags, or any configuration that business users should control.
⚠️ Migration from v2.x to v3.0
Version 3.0 introduces a simplified API. Type-specific methods have been replaced with unified get() and set():
# Before (v2.x)
value = param.int()
param.set_int(42)
title = Parameter.objects.str("BLOG_TITLE")
# After (v3.0)
value = param.get()
param.set(42)
param = Parameter.objects.get(slug="BLOG_TITLE")
title = param.get()
New feature: auto_cast parameter to convert string input to native type:
param.set("42", auto_cast=True) # Converts "42" to int for INT parameters
See CHANGELOG.md for full details.
Quick Start
Installation
pip install django-app-parameter
For encryption support (optional):
pip install django-app-parameter[cryptography]
Requirements: Python 3.10+ • Django 4.2+
Compatibility Matrix
| Python | Django 4.2 LTS | Django 5.2 LTS | Django 6.0 |
|---|---|---|---|
| 3.10 | ✅ | ✅ | ❌ |
| 3.11 | ✅ | ✅ | ❌ |
| 3.12 | ✅ | ✅ | ✅ |
| 3.13 | ✅ | ✅ | ✅ |
| 3.14 | ❌ | ✅ | ✅ |
Configuration
- Add to
INSTALLED_APPS:
INSTALLED_APPS = [
...
"django_app_parameter",
]
- Optional - make global parameters available in all templates:
TEMPLATES = [
{
...
"OPTIONS": {
"context_processors": [
...
"django_app_parameter.context_processors.add_global_parameter_context",
],
},
},
]
- Run migrations:
python manage.py migrate
- Access Django admin to create your first parameters!
Basic Usage
Reading Parameters
In Python code:
from django_app_parameter import app_parameter
# Read parameter value
title = app_parameter.BLOG_TITLE
email = app_parameter.CONTACT_EMAIL
In templates (for global parameters):
<title>{{ BLOG_TITLE }}</title>
Writing Parameters
# Update parameter value programmatically
app_parameter.BLOG_TITLE = "My New Title"
Parameter Names → Slugs
Parameters are accessed via auto-generated slugs:
"Blog Title" → BLOG_TITLE
"sender e-mail" → SENDER_E_MAIL
"##weird@Na_me" → WEIRDNA_ME
Features
Supported Types
String • Integer • Float • Boolean • URL • Email • JSON List • JSON Dict • File Path • Duration • Percentage • DateTime • Date • Time
Bulk Import/Export
Load parameters from JSON:
python manage.py dap_load --file parameters.json
Export all parameters:
python manage.py dap_dump --file backup.json
Example JSON format:
[
{"name": "Site Title", "value": "My Site", "is_global": true},
{"name": "Max Upload Size", "value": "10485760", "value_type": "INT"}
]
Use --no-update to only create new parameters without overwriting existing ones (useful in deployment scripts).
Validation
Attach validators to parameters (min/max value, length, regex, choices, etc.) - configured through Django admin or custom validators.
Encryption
Enable encryption for sensitive parameters (requires cryptography extra). Manage encryption keys with the dap_rotate_key command.
History Tracking
Enable enable_history to track all value changes with timestamps - viewable in Django admin.
📖 Read the full documentation for detailed information on all features.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for development guidelines.
Requirements for contributions:
- Format code with Ruff
- Add type hints (validated with Pyright)
- Maintain 100% test coverage
Links
License
CC0 1.0 Universal - Public Domain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_app_parameter-3.2.0.tar.gz.
File metadata
- Download URL: django_app_parameter-3.2.0.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a69b46b407bc9b5d40b11d804276ab3789970a040ae831152f4084ab346fe151
|
|
| MD5 |
5885a799a3e3caafb8a30e8142f086bf
|
|
| BLAKE2b-256 |
e99c6528ce27032d6d88e043fa8f74869dd00fec0d53a55cf38aa0ae637e491b
|
Provenance
The following attestation bundles were made for django_app_parameter-3.2.0.tar.gz:
Publisher:
publish.yml on Swannbm/django-app-parameter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_app_parameter-3.2.0.tar.gz -
Subject digest:
a69b46b407bc9b5d40b11d804276ab3789970a040ae831152f4084ab346fe151 - Sigstore transparency entry: 856413530
- Sigstore integration time:
-
Permalink:
Swannbm/django-app-parameter@272ee292fdea90bdb9a70161c774ea0c3af30251 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/Swannbm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@272ee292fdea90bdb9a70161c774ea0c3af30251 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_app_parameter-3.2.0-py3-none-any.whl.
File metadata
- Download URL: django_app_parameter-3.2.0-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c95c79f88eb46d84e75055daf378979c360f7e5b61089c51354edf1c58711df
|
|
| MD5 |
603d1a64ba345f42989faeb30988e0f4
|
|
| BLAKE2b-256 |
068d1c663fe70a095a661e2ff894dda05044e7ebc91bdc1dec7cb98fedbd0d48
|
Provenance
The following attestation bundles were made for django_app_parameter-3.2.0-py3-none-any.whl:
Publisher:
publish.yml on Swannbm/django-app-parameter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_app_parameter-3.2.0-py3-none-any.whl -
Subject digest:
6c95c79f88eb46d84e75055daf378979c360f7e5b61089c51354edf1c58711df - Sigstore transparency entry: 856413580
- Sigstore integration time:
-
Permalink:
Swannbm/django-app-parameter@272ee292fdea90bdb9a70161c774ea0c3af30251 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/Swannbm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@272ee292fdea90bdb9a70161c774ea0c3af30251 -
Trigger Event:
push
-
Statement type: