Usage

Loading templates, rendering contexts, and error handling

1 min read 117 words

Practical patterns for using Kida in your applications.

Quick Reference

from kida import Environment, FileSystemLoader

# Create environment
env = Environment(
    loader=FileSystemLoader("templates/"),
    autoescape=True,
)

# Load and render
template = env.get_template("page.html")
html = template.render(title="Hello", items=[1, 2, 3])

# Compile from string (not cached)
template = env.from_string("{{ name }}")
html = template.render(name="World")