Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Flask on App Engine

Flask on App Engine

Slides to a talk that I presented at the Boston App Engine meetup on May 23, 2011.

David Baumgold

May 23, 2011
Tweet

More Decks by David Baumgold

Other Decks in Programming

Transcript

  1. hello.py from flask import Flask app = Flask(__name__) @app.route('/') def

    index(): return 'Hello Flask!' if __name__ == '__main__': app.run()
  2. hello.py from flask import Flask, render_template app = Flask(__name__) @app.route('/',

    defaults={'name': 'Flask'}) @app.route('/<name>') def index(name): return render_template('hello.html', name=name) if __name__ == '__main__': app.run()
  3. hello.html {% extends 'layout.html' %} {% block title %}Greetings{% endblock

    %} {% block body %} <h1>Hello {{ name }}!</h1> {% endblock %}
  4. layout.html <!doctype html> <head> <title>{% block title %}{% endblock %}</title>

    </head> <body> {% block body %}{% endblock %} </body>
  5. $5"'0&*',<*,6,* +0'5*=''=#/:!""/(=$(/:/>&:?/@!"":4&$#*$5"'0&*04(8?,=$8!""* * 9/+*04(8!""AB)* ****+0'5*+#!,-!""*$5"'0&*!""* * ****$+*',:/(.$0'(:=/&ACDEFGEF8DHIJKLFECB:,&!0&,?$&7ACM/.CB)* ********!"":9/@4=NJ04/* * ****04(8?,=$8!""A!""B*

    * $+*88(!5/88*NN*O885!$(88O)* ****0''&8"!&7*N*',:"!&7:9$0(!5/A',:"!&7:!@,"!&7A88+$#/88BB* ****#$@8"!&7*N*',:"!&7:P'$(A0''&8"!&7<*C#$@CB* ****/==,*N*Q',:"!&7:P'$(A#$@8"!&7<*+B*+'0*+*$(** ********',:#$,&9$0A#$@8"!&7B*$+*+:/(9,?$&7AO:/==OBR* ****,6,:"!&7:/>&/(9AQ#$@8"!&7R*S*/==,B* ******** ****04(8!""AB* )"$0:73-
  6. YU?C0/$+0/- >+A)&[",$%"?$+0- >$,C&N7,+"%/- W5C)$0*- N0$?&WC/?$0*- \E(?5- \7C0M!- LA"#"?"A- LC0/5$- !C9(*&W++,9"A-

    ]KD>&^A+?C;?$+0- ]";5$0*- W"/=&<(C(C/- M0?CA0"?$+0",$_"?$+0- K?"?$;&E//C?&@"0"*C)C0?- WC/?&D(00CA- `@aOD^]-