Template loader for templates stored in the database (IPLweb maintenance fork)
Project description
django-dbtemplates-iplweb
dbtemplates is a Django app that stores templates in the database and
exposes them through a regular Django template loader — so templates can be
edited from the admin instead of being redeployed as files.
Originally developed by Jannis Leidel and Jazzband. This fork is actively maintained by IPLweb.
Support graciously provided by
Why?
Django's built-in template loaders read from the filesystem or app
directories. That works well for developer-owned templates, but not for
content that needs to change without a deploy (marketing copy, transactional
email bodies, error pages, site-specific overrides). dbtemplates adds a
loader that reads templates from a database model, so non-developers can
edit them via the admin and changes take effect immediately.
Features
- Database-backed Django template loader — drop-in with the standard
TEMPLATES.OPTIONS.loaderschain - Edit templates through the Django admin (syntax highlighting included)
- Multi-site support via
django.contrib.sites— the same template name can resolve to different content per site - Cache integration with Django's cache framework; invalidation on save
- Management commands:
sync_templates— bidirectional sync between the database and filesystem templatescheck_template_syntax— validate all stored templatescreate_error_templates— scaffold404.html/500.htmlrows
- Admin actions and optional versioned storage
Supported versions
Python
| 3.10 | 3.11 | 3.12 | 3.13 |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
Django
| Django \ Python | 3.10 | 3.11 | 3.12 | 3.13 |
|---|---|---|---|---|
| 4.2 LTS | ✓ | ✓ | ✓ | ✓ |
| 5.0 | ✓ | ✓ | ✓ | ✗ |
| 5.1 | ✓ | ✓ | ✓ | ✓ |
| 5.2 | ✓ | ✓ | ✓ | ✓ |
Matrix derived from tox.ini and Django's own Python support matrix.
djmain (Django's unreleased main branch) is tested against Python
3.12 / 3.13.
Installation
Using uv (recommended)
uv add django-dbtemplates-iplweb
Using pip
pip install django-dbtemplates-iplweb
The Python import name stays dbtemplates, so no code changes are needed
when migrating from upstream django-dbtemplates:
from dbtemplates.models import Template
From git (latest master)
uv add "git+https://github.com/mpasternak/django-dbtemplates-iplweb.git"
# or
pip install "git+https://github.com/mpasternak/django-dbtemplates-iplweb.git"
Quick start
-
Add
dbtemplatestoINSTALLED_APPSalongsidedjango.contrib.sitesanddjango.contrib.admin:INSTALLED_APPS = [ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.sites", "django.contrib.admin", "dbtemplates", ]
-
Add
dbtemplates.loader.LoadertoTEMPLATES.OPTIONS.loaders:TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "OPTIONS": { "loaders": [ "django.template.loaders.filesystem.Loader", "django.template.loaders.app_directories.Loader", "dbtemplates.loader.Loader", ], }, }, ]
Put
dbtemplates.loader.Loaderlast to use database templates as a fallback, or first to let them override on-disk templates. -
Apply migrations and start the server:
python manage.py migrate python manage.py runserver
-
Open the admin, go to Database templates → Templates, and create entries with a
name(e.g.blog/entry_list.html) and templatecontent.
See https://django-dbtemplates.readthedocs.io/ for the complete documentation.
Links
- Documentation: https://django-dbtemplates.readthedocs.io/
- Changelog: https://django-dbtemplates.readthedocs.io/en/latest/changelog.html
- Upstream source: https://github.com/jazzband/django-dbtemplates
- This fork: https://github.com/mpasternak/django-dbtemplates-iplweb
License
BSD — see LICENSE for details.
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_dbtemplates_iplweb-4.3.2.tar.gz.
File metadata
- Download URL: django_dbtemplates_iplweb-4.3.2.tar.gz
- Upload date:
- Size: 80.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32e2913e48784b1d004a44341bc34a7202117d474099a13adb757a1ad4e10e5d
|
|
| MD5 |
2eeaad50b7692a62b6ee055ec6b3fd66
|
|
| BLAKE2b-256 |
588968a7161426db8837dd7fea0607f63eb2e45c147726544395221f2344c985
|
File details
Details for the file django_dbtemplates_iplweb-4.3.2-py3-none-any.whl.
File metadata
- Download URL: django_dbtemplates_iplweb-4.3.2-py3-none-any.whl
- Upload date:
- Size: 86.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e3290ed15f5a2c797e72936d8d1f4d06dd7155409183c0af769e532013737d2
|
|
| MD5 |
58bb47832b8f030b29dbce6f84c15f4b
|
|
| BLAKE2b-256 |
18f23c3e2b5117e351a1aa0a5a888044e2ebfb85f193036ea9fbc81fbb001015
|