django-distill turns selected Django URLs into files for a static website. It suits sites where a full dynamic deployment is unnecessary but Django templates, reusable navigation, and familiar project conventions remain useful. Static files need no extra database queries when served and are easy to cache. section 13.5 section 1.2.3
A static site generator combines templates and reusable page components, then writes the resulting pages as files. django-distill keeps that workflow inside a Django project, so templates can provide a consistent look without learning another generator’s syntax. section 13.5 section 13.6
Install the library with `python -m pip install django-distill`, then add `django_distill` to `INSTALLED_APPS`. In URL configuration, replace `path()` for pages to be generated with `distill_path()`. The replacement preserves normal site behavior while recording enough information to generate a file for each mapped view. section 13.5
Each distilled route adds one important piece beyond an ordinary Django route:
- Use `distill_path()` instead of `path()` for a URL that should become static output. section 13.5
- Provide the filename that should be generated for the view, in addition to the usual route information. section 13.5
- Run the provided management command to output static versions of URLs mapped by Distill. section 13.5
The result is a subset of a Django project whose URLs map directly to served files. This is useful when content changes infrequently and the project benefits more from simple static hosting than from a running Django service. section 13.6 section 13.5
Recipe site
A family recipe collection can keep recipes in data files and render them through a simple Django view. Distill can generate HTML for every recipe, leaving a static site that can be hosted by packaging and sending the generated files to a server. section 13.5
