coltrane is designed to be used without a database, however, sometimes it’s useful to have access to data inside your templates.

JSON data directory

Create a directory named data in your project folder (if it doesn’t already exist) and create JSON files in that directory. The name of the file (without the json extension) will be used as the key in the context data.

If there are JSON files in sub-directories, the directory names will be included in the dictionary hierarchy.


    {"name": "Douglas Adams"}


    {"title": "The Hitchhiker's Guide to the Galaxy"}


# index

{{ }} is the author.

{{ }} is the book title.

Generated index.html

<h1 id="index">index</h1>

<p>Douglas Adams is the author.</p>

<p>The Hitchhiker's Guide to the Galaxy is the book title.</p>