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
Sipping from a Flask
Search
Nick DiRienzo
February 02, 2013
0
170
Sipping from a Flask
A short and noobish talk on Flask. Given at BarCamp Buffalo Spring 2013.
Nick DiRienzo
February 02, 2013
Tweet
Share
More Decks by Nick DiRienzo
See All by Nick DiRienzo
How Optimizely scaled its REST API with asyncio
nickdirienzo
0
200
How to communicate effectively with the young people of today
nickdirienzo
0
39
Let's Talk Facebook
nickdirienzo
0
62
Go Code! (and other things)
nickdirienzo
1
71
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Code Reviewing Like a Champion
maltzj
525
40k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
GitHub's CSS Performance
jonrohan
1032
470k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Speed Design
sergeychernyshev
32
1.1k
GraphQLとの向き合い方2022年版
quramy
49
14k
A Tale of Four Properties
chriscoyier
160
23k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Transcript
Sipping from a Flask
@nickdirienzo UB ACM UB Hacking
ASSUMING Python: pip, virtualenv HTTP methods PostgreSQL
FLASK Microframework Flexible
LET’S GO mkdir todo && cd todo virtualenv venv --distribute
source venv/bin/activate pip install flask
app.py import flask app = flask.Flask(__name__) @app.route(‘/’) def index(): return
‘hai’ if __name__ == ‘__main__’: app.run()
DAMN GOOD DRANK
python app.py
TEMPLATING mkdir templates cd templates Jinja2 or whatever
index.html <!doctype> <html> <head> <title>Todos</title> </head> <body> <p>Hey you!</p> </body>
</html>
app.py @app.route(‘/’) def index(): return flask.render_template(‘index.html’)
app.py @app.route(‘/’) def index(): if ‘name’ in flask.request.args: name =
flask.request.args[‘name’] else: name = ‘Buffalo’ return flask.render_template(‘index.html’, name=name)
index.html <!doctype> <html> <head> <title>Todos</title> </head> <body> <p>Hey {{ name
}}!</p> </body> </html>
Still Learning ORM Third-party Modules Blueprints
Deploy App Engine DIY Heroku
Todo
Questions?