SlideShare a Scribd company logo
Baltimore Innovation Week 2015
Python in the Cloud:
Django vs Flask
Alex Viana (@AlexVianaPro)
Terbium Labs (@TerbiumLabs)
and
Terbium Labs
❖ Terbium Labs is a Baltimore-based data intelligence
company. Our product, Matchlight, allows customers to
monitor the dark web for stolen data.
❖ Matchlight is primarily written in Python, running on
AWS.
Motivation
❖ Django and Flask are the two most popular Python web
frameworks.
❖ We use both frameworks to fill different roles in our
work at Terbium Labs.
❖ It was surprisingly difficult to come to a firm decision
that this was the right direction.
❖ This talk is about what we learned in the process and
how it informed our decision.
Flask
❖ Flask is what the majority of our services runs on.
❖ Flask is a bare-bones Python web “microframework”.
❖ It’s great for building lightweight apps or
“microservices”.
❖ How lightweight? How Mirco?
Flask is Light
“Flask will never have a database layer. It will not have a form
library or anything else in that direction. Flask itself just bridges
to Werkzeug to implement a proper WSGI application and to
Jinja2 to handle templating. It also binds to a few common
standard library packages such as logging. Everything else is up
for extensions.”



- Flask Documentation

http://flask.pocoo.org/docs/0.10/design/#what-flask-is-what-
flask-is-not
Flask’s Hello World
from flask import Flask

app = Flask(__name__)



@app.route("/")

def hello():

return "Hello World!"



if __name__ == "__main__":

app.run()
Your Library as a Flask App
from flask import Flask

from my_module import important_function

app = Flask(__name__)



@app.route("/")

def hello():

results = important_function()

return results



if __name__ == "__main__":

app.run()
Flask in a Startup
❖ Don’t have to wrap your head around any new
framework patterns.
❖ Spend most of your time writing business logic not app
logic.
❖ Flask is excellent for the low-overhead rapid
implementation requirements start up development.
Issues with Flask
❖ On some of our larger REST API’s things got tricky.
❖ Lots of design considerations with side effects.
❖ Development was slowing down.
❖ Maybe Flask was the wrong choice? So we looked to
Django.
Django
❖ Django is far and away the most used Python web
framework.
❖ It’s the “batteries included” option: database ORM,
forms, admin interface, etc.
❖ But this means stopping everything and learning a new
framework. How do we know this is the right choice?
Python vs Django
❖ A little Googling on the internet give you something like
this:
❖ Django is for more full-featured applications.
❖ Flask is for more simple apps and rapid prototyping.
❖ Easy! But our product is made up of REST-ful micro
services, shouldn’t Flask be perfect?
More Confusion
❖ Flask is deployed at LinkedIn, Pinterest, Twillio, and the
2012 Obama election campaign. That’s big stuff!
❖ Miguel Grinberg’s Flask book builds a blog app with data
migrations, unit tests, authentication, etc. Those are a lot
of features!
❖ On the other hand we have the Django REST Framework.
REST is pretty lean, right?
❖ So who’s right? How do we choose? The clock is ticking…
Enter Django REST Framework
❖ So we gave Django REST framework a try.
❖ Django REST seemed like a contradiction at first; Django
just seemed too heavy for an API.
❖ But, we realized there is a -lot- that goes into a REST API:
authentication, serialization, permissions, data model,
queries, testing, pagination, …
❖ Then we had our breakthrough…
Flask and Django
❖ Think of Flask as a web framework framework!
❖ Put another way, Flask is not your framework. You use
Flask to build your framework.
❖ Development was slowing down because we weren’t
building our product, we were building our framework.
Flask as a Framework Framework
❖ In the “Hello World” case this is trivial, all you need is in
Flask, basically just a WSGI server.
❖ As you scale up you end up having to implement
everything yourself, a-la the Flask book.
❖ Once you deviate from that - you’re on your own.
❖ Which can be great! Unless it’s not.
Where Flask is Great
❖ This is why The Flask book is so great; it lays out all the
decisions for you.
❖ And this is why major projects can be written in Flask at
companies with deep resource and experience pools.
❖ And small project are a breeze because there’s literally
nothing else in the framework to think about.
❖ And this why everything in-between is so tough.
Building a Framework
❖ Is hard … just an FYI.
❖ Requires significant developer time.
❖ More importantly it requires informed opinions about
how your framework should work.
❖ Even beyond that it requires knowledge about what
decisions have to be made and how they interact.
Final Remarks
❖ The driver for improving our technology stack was a
sense we were working against, not with our tools. Don’t
ignore that, it’s a clue something is wrong.
❖ Once we realized the pain points and benefits of both
systems we could confidently select different tools for
different jobs. Don’t underestimate the impact of this.
❖ Both are great projects, we’re indebted to both teams.
Thank you for your attention.
Questions?

More Related Content

What's hot (20)

PPTX
The Final Frontier
Domenic Denicola
 
PDF
Front-End Modernization for Mortals
cgack
 
PPTX
Untangling - fall2017 - week 7
Derek Jacoby
 
PPTX
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JSFestUA
 
PDF
Dumb and smart components + redux (1)
Brecht Billiet
 
PPTX
Tipping the Scale - Eyal Eizenberg
Wix Engineering
 
PPTX
Untangling - fall2017 - week5
Derek Jacoby
 
PPTX
Untangling spring week6
Derek Jacoby
 
KEY
(For non-developers) HTML5: A richer web for everyone
Chris Mills
 
KEY
HTML5: what's new?
Chris Mills
 
PPTX
WTF: Where To Focus when you take over a Drupal project
Symetris
 
PPTX
Untangling the web11
Derek Jacoby
 
PPTX
Untangling the web week1
Derek Jacoby
 
PPTX
What were you thinking? Worst Translation Practices
Keith Brooks
 
PPTX
Untangling - fall2017 - week6
Derek Jacoby
 
PPTX
My Dog Ate My Translation Assignment
Keith Brooks
 
PPTX
Untangling7
Derek Jacoby
 
PPTX
Untangling spring week2
Derek Jacoby
 
PPTX
Real World Windows 8 Apps in JavaScript
Domenic Denicola
 
PPTX
Untangling spring week3
Derek Jacoby
 
The Final Frontier
Domenic Denicola
 
Front-End Modernization for Mortals
cgack
 
Untangling - fall2017 - week 7
Derek Jacoby
 
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JSFestUA
 
Dumb and smart components + redux (1)
Brecht Billiet
 
Tipping the Scale - Eyal Eizenberg
Wix Engineering
 
Untangling - fall2017 - week5
Derek Jacoby
 
Untangling spring week6
Derek Jacoby
 
(For non-developers) HTML5: A richer web for everyone
Chris Mills
 
HTML5: what's new?
Chris Mills
 
WTF: Where To Focus when you take over a Drupal project
Symetris
 
Untangling the web11
Derek Jacoby
 
Untangling the web week1
Derek Jacoby
 
What were you thinking? Worst Translation Practices
Keith Brooks
 
Untangling - fall2017 - week6
Derek Jacoby
 
My Dog Ate My Translation Assignment
Keith Brooks
 
Untangling7
Derek Jacoby
 
Untangling spring week2
Derek Jacoby
 
Real World Windows 8 Apps in JavaScript
Domenic Denicola
 
Untangling spring week3
Derek Jacoby
 

Viewers also liked (17)

PPTX
k10715 ankit kr. verma (Case study)
shailesh yadav
 
PDF
Zigbee social network
Intersog
 
PPTX
Everything is changing in IT
Dr. Jimmy Schwarzkopf
 
PPTX
Mapa conceptual
Johanna Moreno
 
PPTX
Brand identity prism kepferer model
Sabil Ahammed
 
PDF
Eurotech contribution to the AGILE-IoT project
AGILE IoT
 
PDF
Mao3D Prótese de mão feitas por impressão 3D (Slides expo3dbr 2016)
Maria Elizete Kunkel
 
PDF
FIWARE-IoT-Broker-introduction
gesslers
 
PPTX
Best Abraham Lincoln Quotes in Hindi
www.aasaanhai.net
 
PDF
2016 07-20-demo session
AGILE IoT
 
PPTX
England ppt final
Angelito Pera
 
PDF
2016 07-20-wp4-q2 f2 f berlin
AGILE IoT
 
PDF
WORKSHOP DOING BUSINESS IN GERMANY: OPPORTUNITIES IN THE GERMAN ENERGY MARKET
Cristina Wasmeier
 
PPTX
Internet of Things - Lu, Ralph
ralphlu
 
PDF
MOLTO poster for ACL 2010, Uppsala Sweden
Olga Caprotti
 
PDF
BoldPM Insights Summary: Why Smart, Connected Devices Are Transforming Busine...
Hector Del Castillo, CPM, CPMM
 
PPTX
Agile Cloud Service Strategy using DevOps
Jason Stevenson
 
k10715 ankit kr. verma (Case study)
shailesh yadav
 
Zigbee social network
Intersog
 
Everything is changing in IT
Dr. Jimmy Schwarzkopf
 
Mapa conceptual
Johanna Moreno
 
Brand identity prism kepferer model
Sabil Ahammed
 
Eurotech contribution to the AGILE-IoT project
AGILE IoT
 
Mao3D Prótese de mão feitas por impressão 3D (Slides expo3dbr 2016)
Maria Elizete Kunkel
 
FIWARE-IoT-Broker-introduction
gesslers
 
Best Abraham Lincoln Quotes in Hindi
www.aasaanhai.net
 
2016 07-20-demo session
AGILE IoT
 
England ppt final
Angelito Pera
 
2016 07-20-wp4-q2 f2 f berlin
AGILE IoT
 
WORKSHOP DOING BUSINESS IN GERMANY: OPPORTUNITIES IN THE GERMAN ENERGY MARKET
Cristina Wasmeier
 
Internet of Things - Lu, Ralph
ralphlu
 
MOLTO poster for ACL 2010, Uppsala Sweden
Olga Caprotti
 
BoldPM Insights Summary: Why Smart, Connected Devices Are Transforming Busine...
Hector Del Castillo, CPM, CPMM
 
Agile Cloud Service Strategy using DevOps
Jason Stevenson
 
Ad

Similar to BIW15: Python in the Cloud: Django and Flaks (20)

PDF
Django vs flask
Nitish Garg
 
PDF
Django vs Flask_ Which Python Framework to Choose and When to Use _ Phenomena...
dcostacarlos95
 
PPTX
Flask and Introduction to web frameworks
dipendralfs
 
PDF
Python Web Frameworks: Django vs. Flask for Web Development
Uncodemy
 
PDF
Difference Between Flask vs Django .pdf
SudhanshiBakre1
 
PDF
Pycon 2014 - Flask vs Django vs Web.py (PANEL)
Aravind Krishnaswamy
 
PPTX
This ppt is for the java script chapter 2
AltafSMT
 
PDF
Building Web Applications with Python: Flask and Django Explained
priyanka rajput
 
DOCX
Python for Web Development Django, Flask, and Beyond.docx
analyticsinsightmaga
 
PPTX
Django vs Flask
Rachel Sanders
 
PPTX
Flask vs. Django
Rachel Sanders
 
PPTX
Flask
Mamta Kumari
 
PDF
Django For Beginners Converted William S Vincent
sarkingiio
 
PPTX
Python for web development
Luis Borbon
 
PPTX
Python_Web_API_Flask_Streamlit.pptx sample
aniketwaghskncomp
 
PDF
What Web Framework To Use?
Kasra Khosravi
 
PPTX
Intro to flask2
Mohamed Essam
 
PPTX
Intro to flask
Mohamed Essam
 
PDF
Realtime Apps with Django
Renyi Khor
 
PDF
Top 10 python frameworks for web development in 2020
Alaina Carter
 
Django vs flask
Nitish Garg
 
Django vs Flask_ Which Python Framework to Choose and When to Use _ Phenomena...
dcostacarlos95
 
Flask and Introduction to web frameworks
dipendralfs
 
Python Web Frameworks: Django vs. Flask for Web Development
Uncodemy
 
Difference Between Flask vs Django .pdf
SudhanshiBakre1
 
Pycon 2014 - Flask vs Django vs Web.py (PANEL)
Aravind Krishnaswamy
 
This ppt is for the java script chapter 2
AltafSMT
 
Building Web Applications with Python: Flask and Django Explained
priyanka rajput
 
Python for Web Development Django, Flask, and Beyond.docx
analyticsinsightmaga
 
Django vs Flask
Rachel Sanders
 
Flask vs. Django
Rachel Sanders
 
Django For Beginners Converted William S Vincent
sarkingiio
 
Python for web development
Luis Borbon
 
Python_Web_API_Flask_Streamlit.pptx sample
aniketwaghskncomp
 
What Web Framework To Use?
Kasra Khosravi
 
Intro to flask2
Mohamed Essam
 
Intro to flask
Mohamed Essam
 
Realtime Apps with Django
Renyi Khor
 
Top 10 python frameworks for web development in 2020
Alaina Carter
 
Ad

Recently uploaded (20)

PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Day2 B2 Best.pptx
helenjenefa1
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
MRRS Strength and Durability of Concrete
CivilMythili
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Pressure Measurement training for engineers and Technicians
AIESOLUTIONS
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Design Thinking basics for Engineers.pdf
CMR University
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Element 7. CHEMICAL AND BIOLOGICAL AGENT.pptx
merrandomohandas
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 

BIW15: Python in the Cloud: Django and Flaks

  • 1. Baltimore Innovation Week 2015 Python in the Cloud: Django vs Flask Alex Viana (@AlexVianaPro) Terbium Labs (@TerbiumLabs) and
  • 2. Terbium Labs ❖ Terbium Labs is a Baltimore-based data intelligence company. Our product, Matchlight, allows customers to monitor the dark web for stolen data. ❖ Matchlight is primarily written in Python, running on AWS.
  • 3. Motivation ❖ Django and Flask are the two most popular Python web frameworks. ❖ We use both frameworks to fill different roles in our work at Terbium Labs. ❖ It was surprisingly difficult to come to a firm decision that this was the right direction. ❖ This talk is about what we learned in the process and how it informed our decision.
  • 4. Flask ❖ Flask is what the majority of our services runs on. ❖ Flask is a bare-bones Python web “microframework”. ❖ It’s great for building lightweight apps or “microservices”. ❖ How lightweight? How Mirco?
  • 5. Flask is Light “Flask will never have a database layer. It will not have a form library or anything else in that direction. Flask itself just bridges to Werkzeug to implement a proper WSGI application and to Jinja2 to handle templating. It also binds to a few common standard library packages such as logging. Everything else is up for extensions.”
 
 - Flask Documentation
 http://flask.pocoo.org/docs/0.10/design/#what-flask-is-what- flask-is-not
  • 6. Flask’s Hello World from flask import Flask
 app = Flask(__name__)
 
 @app.route("/")
 def hello():
 return "Hello World!"
 
 if __name__ == "__main__":
 app.run()
  • 7. Your Library as a Flask App from flask import Flask
 from my_module import important_function
 app = Flask(__name__)
 
 @app.route("/")
 def hello():
 results = important_function()
 return results
 
 if __name__ == "__main__":
 app.run()
  • 8. Flask in a Startup ❖ Don’t have to wrap your head around any new framework patterns. ❖ Spend most of your time writing business logic not app logic. ❖ Flask is excellent for the low-overhead rapid implementation requirements start up development.
  • 9. Issues with Flask ❖ On some of our larger REST API’s things got tricky. ❖ Lots of design considerations with side effects. ❖ Development was slowing down. ❖ Maybe Flask was the wrong choice? So we looked to Django.
  • 10. Django ❖ Django is far and away the most used Python web framework. ❖ It’s the “batteries included” option: database ORM, forms, admin interface, etc. ❖ But this means stopping everything and learning a new framework. How do we know this is the right choice?
  • 11. Python vs Django ❖ A little Googling on the internet give you something like this: ❖ Django is for more full-featured applications. ❖ Flask is for more simple apps and rapid prototyping. ❖ Easy! But our product is made up of REST-ful micro services, shouldn’t Flask be perfect?
  • 12. More Confusion ❖ Flask is deployed at LinkedIn, Pinterest, Twillio, and the 2012 Obama election campaign. That’s big stuff! ❖ Miguel Grinberg’s Flask book builds a blog app with data migrations, unit tests, authentication, etc. Those are a lot of features! ❖ On the other hand we have the Django REST Framework. REST is pretty lean, right? ❖ So who’s right? How do we choose? The clock is ticking…
  • 13. Enter Django REST Framework ❖ So we gave Django REST framework a try. ❖ Django REST seemed like a contradiction at first; Django just seemed too heavy for an API. ❖ But, we realized there is a -lot- that goes into a REST API: authentication, serialization, permissions, data model, queries, testing, pagination, … ❖ Then we had our breakthrough…
  • 14. Flask and Django ❖ Think of Flask as a web framework framework! ❖ Put another way, Flask is not your framework. You use Flask to build your framework. ❖ Development was slowing down because we weren’t building our product, we were building our framework.
  • 15. Flask as a Framework Framework ❖ In the “Hello World” case this is trivial, all you need is in Flask, basically just a WSGI server. ❖ As you scale up you end up having to implement everything yourself, a-la the Flask book. ❖ Once you deviate from that - you’re on your own. ❖ Which can be great! Unless it’s not.
  • 16. Where Flask is Great ❖ This is why The Flask book is so great; it lays out all the decisions for you. ❖ And this is why major projects can be written in Flask at companies with deep resource and experience pools. ❖ And small project are a breeze because there’s literally nothing else in the framework to think about. ❖ And this why everything in-between is so tough.
  • 17. Building a Framework ❖ Is hard … just an FYI. ❖ Requires significant developer time. ❖ More importantly it requires informed opinions about how your framework should work. ❖ Even beyond that it requires knowledge about what decisions have to be made and how they interact.
  • 18. Final Remarks ❖ The driver for improving our technology stack was a sense we were working against, not with our tools. Don’t ignore that, it’s a clue something is wrong. ❖ Once we realized the pain points and benefits of both systems we could confidently select different tools for different jobs. Don’t underestimate the impact of this. ❖ Both are great projects, we’re indebted to both teams.
  • 19. Thank you for your attention. Questions?