Skip to main content

django-dbtemplates-iplweb

PyPI Tests Python Version Django Version License Documentation

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

IPLweb

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.loaders chain
  • 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 templates
    • check_template_syntax — validate all stored templates
    • create_error_templates — scaffold 404.html / 500.html rows
  • 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 main)

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

  1. Add dbtemplates to INSTALLED_APPS alongside django.contrib.sites and django.contrib.admin:

    INSTALLED_APPS = [
        "django.contrib.auth",
        "django.contrib.contenttypes",
        "django.contrib.sessions",
        "django.contrib.sites",
        "django.contrib.admin",
        "dbtemplates",
    ]
    
  2. Add dbtemplates.loader.Loader to TEMPLATES.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.Loader last to use database templates as a fallback, or first to let them override on-disk templates.

  3. Apply migrations and start the server:

    python manage.py migrate
    python manage.py runserver
    
  4. Open the admin, go to Database templates → Templates, and create entries with a name (e.g. blog/entry_list.html) and template content.

See https://django-dbtemplates.readthedocs.io/ for the complete documentation.

Links

License

BSD — see LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_dbtemplates_iplweb-4.4.0.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_dbtemplates_iplweb-4.4.0-py3-none-any.whl (93.2 kB view details)

Uploaded Python 3

File details

Details for the file django_dbtemplates_iplweb-4.4.0.tar.gz.

File metadata

File hashes

Hashes for django_dbtemplates_iplweb-4.4.0.tar.gz
Algorithm Hash digest
SHA256 8f870373545949f7fc3c7db2bc807b3bdfd769c3d2146f50575e6cc84aa25f1c
MD5 92dd8ebc5a482a36ad061107acdc7693
BLAKE2b-256 d86d2e4267b5dc5ea2be0e8bad07ca1bcf76fa74d6463b72dc9dd123917c04ce

See more details on using hashes here.

File details

Details for the file django_dbtemplates_iplweb-4.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_dbtemplates_iplweb-4.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2a5acf4420eedbedf7cede2e82c941624192944c0d44c85f3d716374706ef25
MD5 ad823691b04b2d0be13a9f7f3b014172
BLAKE2b-256 b7ecadb58622c798dfad66a342d8007b842fc3ed95c642738d90c664691e8c7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page