use jinja2 Template directly instead of render_template