Skip to content

Instantly share code, notes, and snippets.

@bacher09
Created September 20, 2014 11:00
Show Gist options
  • Save bacher09/c07e505a028deda29327 to your computer and use it in GitHub Desktop.
Save bacher09/c07e505a028deda29327 to your computer and use it in GitHub Desktop.
jinja do example
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('test.txt')
if __name__ == '__main__':
app.jinja_env.add_extension('jinja2.ext.do')
app.run(debug=True)
{% set mylist = [1, 2, 3] %}
{% do mylist.append(4) %}
{{ mylist }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment