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
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
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
340
さぁV100、メモリをお食べ・・・
nilpe
0
140
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
110
Inside Stream API
skrb
1
710
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
3Dシーンの圧縮
fadis
1
770
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.3k
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
Contextとはなにか
chiroruxx
1
320
Vite+ Unified Toolchain for the Web
naokihaba
0
310
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Discover your Explorer Soul
emna__ayadi
2
1.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
480
Crafting Experiences
bethany
1
180
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
Why Our Code Smells
bkeepers
PRO
340
58k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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/