Skip to main content

Django Typst

A Django template engine that uses Typst to render Portable Document Format (PDF) files.

Full documentation can be found at https://django-typst-engine.readthedocs.io/en/latest/

Installation and Configuration

The Django Typst engine is available from PyPI so you can install it with all the usual tools:

pip install django_typst
# or
uv add django_typst
# or
poetry add django_typst

Once installed, to make the typst engine available, you need to add it to the TEMPLATES configuration in your settings.py. e.g.:

TEMPLATES = [
    ...
    {
        "BACKEND": "django_typst.TypstEngine",
        "NAME": "typst",
        "DIRS": [BASE_DIR / "templates"],
        "APP_DIRS": False,
        "OPTIONS": {
            "ROOT": None,
            "FONT_PATHS": [],
            "IGNORE_SYSTEM_FONTS": False,
            "PDF_STANDARD": "1.7",
            "PPI": None,
        }
    },
]

Note that this should be in addition to the standard Django template engine that was already there.

All the OPTIONS are... optional and the values above represent their defaults should no alternative be provided.

Option Description Default
ROOT The root path to use for relative paths None*
FONT_PATHS Paths to look in for fonts []
IGNORE_SYSTEM_FONTS Only consider fonts in the defined font paths False
PDF_STANDARD PDF revision to target (1.7, a2-b, a3-b) "1.7"
PPI Pixel Per Inch for included PNG None

* The engine with use the folder the template is in as the root if one is not specified.

[!NOTE] The Django Typst Engine does support loading templates from app dirs with the APP_DIR configuration, but just like the jinja2 engine, it expects the in-app folder to have an engine specific name of typst. So if you want to have templates in app directories, please ensure they sit within a folder called typst.

Usage

To use this engine with one of the standard Django class based views you only need to set the template_engine class property to the value "typst". You should also set the content_type property to the value "application/pdf" to ensure the PDF is returned with the correct content type. For example, in a simple TemplateView it would look like this:

from django.views import generic

class MyTemplateView(generic.TemplateView):
  template_engine = "typst"
  content_type = "application/pdf"

  ...

Release files for django-typst 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-typst 0.1.6
File Size Uploaded
django_typst-0.1.6.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-typst 0.1.6
File Interpreter ABI Platform
django_typst-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / django_typst-0.1.6.tar.gz

Download URL django_typst-0.1.6.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4bafd2db76d90c4cd85e69e6fa60c2ac5150e4f85b50e3bae3f77c22e5fbad79
BLAKE2b-256 checksum
How to use checksums
479354c1a2e2361ee8f80b9cafff42b5cee58d65c866a046b1bc75070af9dfe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release files / django_typst-0.1.6-py3-none-any.whl

Download URL django_typst-0.1.6-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21d364e2c744b660e25446f804bbb534dfec45d9ff01ec8205d173ad377cc525
BLAKE2b-256 checksum
How to use checksums
c335520de75c267a66e3e57de34ca9883853e227e153d1c651a5a27226bca63b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page