Variable-based output filenamesΒΆ

This document explains how to render dynamic filenames.

When rendering a directory, it is sometimes useful to use variables in the filenames to output.


This is useless for single files, since most clients allow you to choose the name of the output file.


In the examples below, let’s communicate with a diecutter server using Python requests.

This diecutter serves diecutter’s demo templates.

The diecutter_url variable holds root URL of diecutter service, i.e. something like

When rendering directories, templates having +variable+ in the filename will be resolved against the context data:

>>> url = diecutter_url + 'simple-tree/'
>>> response = requests.get(url)
>>> print response.content
>>> response =, {'name': 'demo'})
>>> archive =
>>> print archive.getnames()


The “variable-based filenames” feature is meant for simple cases. If you need advanced things for filenames, use the dynamic trees feature.

Notice that “variable-based filenames” behaviour is disabled when using the dynamic trees.