Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
No content
Slide 2
Slide 2 text
HELLO.PY from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "hello world" if __name__ == "__main__": app.run()
Slide 3
Slide 3 text
ABOUT
Slide 4
Slide 4 text
BSD LICENSED
Slide 5
Slide 5 text
BUILT BY THE PROS Created by Armin Ronacher Pygments, Sphinx, Jinja2, Werkzeug, Click
Slide 6
Slide 6 text
USED BY THE PROS Pinterest, Twilio, Linked-in, President Obama Campaign, Reddit, Uber, etc.
Slide 7
Slide 7 text
DEAD SIMPLE hello word in 7 lines of code in a single file
Slide 8
Slide 8 text
EASY TO UNDERSTAND just write your ordinary Python code no pseudo-language to undestand
Slide 9
Slide 9 text
MANAGEABLE LEARNING CURVE learn as you go, don’t feel overwhelmed
Slide 10
Slide 10 text
NO IMPOSED STRUCTURE no need to understand things are the wey they are: they aren’t
Slide 11
Slide 11 text
SMALL API 800 LOC, 1500 LOC Tests
Slide 12
Slide 12 text
WELL DOCUMENTED the equivalent of 200 A4 pages of excellent documentation
Slide 13
Slide 13 text
FEATURES
Slide 14
Slide 14 text
WERKZEUG It's hard to find anything that's simpler, more self-contained, or purer-WSGI than Werkzeug — Alex Martelli
Slide 15
Slide 15 text
JINJA2 modern, fast, designer-friendly templating language inspired by Django templates (!)
Slide 16
Slide 16 text
DEVELOPMENT SERVER app.run()
Slide 17
Slide 17 text
DEBUGGER app.run(debug=True)
Slide 18
Slide 18 text
UNIT TESTING flask.app.test_client()
Slide 19
Slide 19 text
RESTFUL REQUEST DISPATCHING modern web applications have beautiful URLs
Slide 20
Slide 20 text
SIGNED SESSION COOKIES session allows you to securely store information specific to a user from one request to the next
Slide 21
Slide 21 text
100% WSGI COMPLIANT
Slide 22
Slide 22 text
VERY STABLE (despite being in beta)
Slide 23
Slide 23 text
RICH ECOSYSTEM Flask-SQLAlchemy, Flask-Admin, Flask-Cache, Flask-Cors, Flask-Login, Flask-Mail, etc.
Slide 24
Slide 24 text
HELLO WORLD
Slide 25
Slide 25 text
HELLO.PY from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return render_template('hello.html') if __name__ == "__main__": app.run()
Slide 26
Slide 26 text
HELLO.HTML {% extends 'layout.html' %} {% block title %}Greetings{% endblock %} {% block body %}
Hello {{ name }}!
{% endblock
Slide 27
Slide 27 text
LAYOUT.HTML {% block title %}{% endblock %} {% block body %}{% endblock %}
Slide 28
Slide 28 text
INSTALL AND RUN $ pip install Flask $ python hello.py * Running on http://localhost:5000/
Slide 29
Slide 29 text
EXTENSIONS RUNDOWN: FLASK-SQLALCHEMY from flask import Flask from flaskext.sqlalchemy import SQLAlchemy app = Flask(__name__) db = SQLAlchemy(app) class User(db.Model): name = db.Column(db.String(40), primary_key=True) email = db.Column(db.String(100)) @app.route('/user/') def show_user(name): user = User.query.filter_by(name=name).first_or_404() return render_template('user.html', user=user)