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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Nick DiRienzo
February 02, 2013
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Sipping from a Flask
A short and noobish talk on Flask. Given at BarCamp Buffalo Spring 2013.
Nick DiRienzo
February 02, 2013
More Decks by Nick DiRienzo
See All by Nick DiRienzo
How Optimizely scaled its REST API with asyncio
nickdirienzo
0
220
How to communicate effectively with the young people of today
nickdirienzo
0
46
Let's Talk Facebook
nickdirienzo
0
69
Go Code! (and other things)
nickdirienzo
1
78
Featured
See All Featured
Designing for Timeless Needs
cassininazir
1
460
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
220
Everyday Curiosity
cassininazir
0
290
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
300
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
First, design no harm
axbom
PRO
2
1.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.5k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
57k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
260
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?