API Reference

The complete public API: engine setup, the @template decorator, direct rendering, and exceptions.

Configuration

Set up the Chameleon template engine once at app startup.

global_init()

Initialize the Chameleon template engine.

engine.clear()

Reset the template engine to its uninitialized state.

Decorating views

Render templates from Flask/Quart view functions (sync or async) and return friendly 404s.

template()

Decorate a Flask or Quart view method to render a Chameleon template.

not_found()

Abort the current view and render a friendly 404 page.

Direct rendering

Render a template to a Response or raw HTML without the decorator.

response()

Render a Chameleon template directly to a flask.Response.

engine.render()

Render a Chameleon template to an HTML string.

Exceptions

Errors raised by the engine. Importable from chameleon_flask directly or from chameleon_flask.exceptions.

FlaskChameleonException

Base exception for all chameleon-flask errors.

FlaskChameleonNotFoundException

Raised by not_found() to signal that a view should render a 404 page.