13.07.2015 Views

Modern Web Applications with Flask and Backbone.js

Modern Web Applications with Flask and Backbone.js

Modern Web Applications with Flask and Backbone.js

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Crash course: FLSK 103@app.route('/user/')def user_page(id):User.query.get_or_404(id)return render_template('user.html',user_id = id,){% extends "webapp.html" %}{% block head %}{{ super() }}window.xx.context.user_id = {{ user_id|to<strong>js</strong>on|safe }};$(function() { UserPage({el: $('.user_page')}); });{% endblock %}{% block body %}{{ super() }}{% endblock %}Complete View & Template of user page(you're not seeing much here - that's the point!)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!