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
110
Agentic Coding: The Future of Software Development with Agents
mitsuhiko
0
900
Do Dumb Things
mitsuhiko
0
990
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
440
Rust at Sentry
mitsuhiko
0
610
Overcoming Variable Payloads to Optimize for Performance
mitsuhiko
0
310
Other Decks in Programming
See All in Programming
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.1k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
680
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
260
「人を評価する AI」の設計と実装
ryoyanara
0
220
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
不幸な GC
chencmd
0
470
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
170
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
270
SlackアプリとLambdaの 連携を構築した話
pawn_4_s
1
130
AIを紡ぐPMのお話
swdtkuy
0
120
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
220
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
480
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
300
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
WENDY [Excerpt]
tessaabrams
11
39k
Agile that works and the tools we love
rasmusluckow
331
22k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
A Tale of Four Properties
chriscoyier
163
24k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
790
How to build a perfect <img>
jonoalderson
1
5.9k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
950
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
210
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
400
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/