Koskamo

The template layer and DTL

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

A template contains the static parts of the desired HTML output plus special syntax describing how dynamic content is inserted. A Django project can be configured with one or several template engines — or zero — and Django ships built-in backends for its own Django template language (DTL) and for Jinja2, with third-party and custom backends possible. A standard API loads and renders templates regardless of backend: loading finds the template for a given identifier and usually compiles it to an in-memory representation, while rendering interpolates the template with context data and returns the resulting string. DTL templates render with a context, a dict-like object mapping keys to values; variables like {{ first_name }} output context values, and tags execute logic. The documentation recommends the DTL unless you have a pressing reason to choose another backend. Warning: the template system is not safe against untrusted template authors — never let users supply their own templates, since template authors can perform XSS attacks and access sensitive properties of template variables. Scope: Django. Reviewed October 4, 2026.

Source and provenance

Original source
docs.djangoproject.com
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.