Flask Snippets

Using Genshi with Flask

Posted by Dag Odenhall on 2010-05-15 @ 17:27 and filed in Template Tricks

Jinja is a very nice text-based templating engine, but if you want an XML-based templating engine, Genshi is a good choice.

Flask-Genshi is a Flask extension that makes it easy. First install it:

$ easy_install Flask-Genshi

Here's a simple app:

from flask import Flask
from flaskext.genshi import Genshi, render_response

app = Flask(__name__)
genshi = Genshi(app)

def index():

For documentation on Genshi see the Genshi wiki.

This snippet by Dag Odenhall can be used freely for anything you like. Consider it public domain.