def stream_template(templatename, **context): APP.update_template_context(context) template = APP.jinja_env.get_template(templatename) rv = template.stream(context) rv.enable_buffering(5) # you might want to buffer up a few items in the template return rv