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
89
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
890
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
610
Overcoming Variable Payloads to Optimize for Performance
mitsuhiko
0
310
Other Decks in Programming
See All in Programming
仕様駆動開発の消費期限
watany
20
7.9k
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
310
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
890
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.5k
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
390
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
590
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
150
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Evolving SEO for Evolving Search Engines
ryanjones
0
250
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
400
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
530
Claude Code のすすめ
schroneko
67
230k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
460
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/