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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Armin Ronacher
June 12, 2010
Programming
590
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
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
800
Do Dumb Things
mitsuhiko
0
950
No Assumptions
mitsuhiko
0
410
The Complexity Genie
mitsuhiko
0
330
The Catch in Rye: Seeding Change and Lessons Learned
mitsuhiko
0
440
Runtime Objects in Rust
mitsuhiko
0
420
Rust at Sentry
mitsuhiko
0
590
Overcoming Variable Payloads to Optimize for Performance
mitsuhiko
0
300
Rust API Design Learnings
mitsuhiko
0
670
Other Decks in Programming
See All in Programming
Oxlintのカスタムルールの現況
syumai
6
1.1k
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.6k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
8
4.8k
JavaDoc 再入門
nagise
1
350
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
260
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
130
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
net-httpのHTTP/2対応について
naruse
0
480
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
Featured
See All Featured
Building an army of robots
kneath
306
46k
Marketing to machines
jonoalderson
1
5.4k
Rails Girls Zürich Keynote
gr2m
96
14k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
940
AI: The stuff that nobody shows you
jnunemaker
PRO
8
710
How STYLIGHT went responsive
nonsquared
100
6.2k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The Cult of Friendly URLs
andyhume
79
6.9k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
350
Discover your Explorer Soul
emna__ayadi
2
1.1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
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/