Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Flask Lighting Talk
Search
Armin Ronacher
June 12, 2010
Programming
600
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Flask Lighting Talk
At DjangoCon.eu 2010
Armin Ronacher
June 12, 2010
More Decks by Armin Ronacher
See All by Armin Ronacher
Reflections on building cloud and local hybrid machine entities
mitsuhiko
1
71
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
880
Do Dumb Things
mitsuhiko
0
980
No Assumptions
mitsuhiko
0
430
The Complexity Genie
mitsuhiko
0
350
The Catch in Rye: Seeding Change and Lessons Learned
mitsuhiko
0
450
Runtime Objects in Rust
mitsuhiko
0
430
Rust at Sentry
mitsuhiko
0
600
Overcoming Variable Payloads to Optimize for Performance
mitsuhiko
0
310
Other Decks in Programming
See All in Programming
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
140
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
160
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
300
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
17k
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
120
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
960
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
200
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
290
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
200
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
3.3k
Google Apps Script で Ruby を動かす
kawahara
0
120
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
180
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The browser strikes back
jonoalderson
0
1.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.1k
RailsConf 2023
tenderlove
30
1.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
Skip the Path - Find Your Career Trail
mkilby
1
170
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
A designer walks into a library…
pauljervisheath
211
24k
Context Engineering - Making Every Token Count
addyosmani
9
1k
Transcript
a gentle introduction into a microframework with good intentions {
Armin Ronacher – http://lucumr.pocoo.org – http://twitter.com/mitsuhiko }
What is Flask? » A microframework » Reusing existing code
» Lots of documentation » Neat way to write small apps
Another µFramework? YES!
Under the Hood » Full power of Werkzeug » Jinja2
as a capable template engine
Under the Hood » 450 Lines of actual Code »
1000 Lines of Tests » 5000 Lines of Documentation
What does it do? » Cookie-based session support » Flashing
of messages » Preconfigured Jinja2 with autoescaping » Serves static files from “static” » Before/After Request hooks » Context local objects » RESTful URL mapping
What else? » Lots of documentation (120 A4 pages) »
Website with lots of snippets » Extension registry (OAuth, OpenID, XML- RPC, CSRF protection …) » Active Mailinglist and IRC Channel
Hello Flask from flask import Flask app = Flask(__name__) @app.route('/')
def index(): return 'Hello World!' if __name__ == '__main__': app.run(debug=True)
Hello Localhost $ python hello.py * Running on http://127.0.0.1:5000/ *
Restarting with reloader...
Rendering Templates from flask import render_template @app.route('/') def index():
return render_template('index.html', variable='value' )
The Request Data from flask import request, flash, redirect, \
url_for, request @app.route('/new-‐comment', methods=['GET', 'POST']) def new_comment(): if request.method == 'POST': Comment(request.form['name'], request.form['text']).save() flash('Comment was added') return redirect(url_for('show_comments')) return render_template('new_comment.html')
Before/After Request import sqlite3 from flask import g @app.before_request def
before_request(): g.db = sqlite3.connect(…) @app.after_request def after_request(response): g.db.close() return response
If Things Break
Where to get? $ pip install Flask http://github.com/mitsuhiko/flask http://flask.pocoo.org/