Created
March 6, 2012 09:42
-
-
Save bradwright/1985341 to your computer and use it in GitHub Desktop.
Flask-MustacheJS integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Example</title> | |
<script type="text/javascript" src="{{ url_for('mustache.static', filename='mustache-loader.js') }}"></script> | |
{{ mustache_templates }} | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Example</title> | |
<script type="text/javascript" src="/_mustache/static/mustache-loader.js"></script> | |
<script type="text/x-mustache-template" id="test.mustache" charset="utf-8"> | |
<p>{{ test_name }}</p> | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
from flask.ext.mustache import FlaskMustache | |
app = Flask(__name__) | |
app = FlaskMustache.attach(app) | |
@app.route('/') | |
def index(): | |
return render_template('index.jinja') | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment