My daughter and I have been learning Python since this past Thanksgiving where we spent the week reading Practical Python Using Python 3. Since then we have been incorporating Python into our daily development, but mainly for desktop applications and utlities. Recently we've been wanting to build websites and web applications using Python. We decided to get started using a new book from O'Reilly as part of the O'Reilly Blogger Program, Flask Web Development, Developing Web Applications with Python.

Flask Web Development

Flask Web Development is a new book from O'Reilly teaching developers how to build Python web application using Flask. We had no experience with Flask before the book, but we were able to follow along quite easily. Flask Web Development is broken up into 3 parts. Part I introduces you to Flask. Part II shows you how to use Flask to build a social blogging application. Part III introduces you to more advanced Flask, such as unit testing, performance, and deployment.

The book starts by introducing you to VIRTUALENV to manage your Flask web applications. Lucky for us, VIRTUALENV and VIRTUALENVWRAPPER have become a staple for us in Python development. We recommend that all Python Developers use VIRTUALENV whether using Flask or not. We also use VIRTUALENVWRAPPER to manage those virtual environments. And, of course, although not mentioned in the book, we also recommend using Homebrew to install both Python 2.7 and Python 3.x on your Mac (if you use OS X).

Being an ASP.NET MVC .NET Developer, I couldn't help but compare Flask to ASP.NET MVC throughout the book. ASP.NET MVC is a very unopinionated web framework and so is Flask. Flask helps you handle HTTP Request and Responses by helping you map Routes to View Functions and display results, but the model, database, and 'guts' of the web application are up to you. This is similar to ASP.NET MVC where the framework provides a controller and a view templating engine, Razor, but leaves the developer to decide the model, database, and other details.

Flask Web Development does a great job explaining how to:

  • Map routes to view functions
  • Use templates and Jinja2
  • Use decorators around view functions ( ASP.NET MVC Filters )
  • Engage request, session, g, and current_app in Flask
  • Use Flash for one-time messages
  • Handle static files
  • Use web forms
  • Invoke databases using SQLAlchemy
  • etc.

Althought Flask Web Development comes with complete source code on GitHub, we like to type the code samples in by hand as we learn more that way. By typing in the code and screwing up, you are much more likely to understand the various moving parts to Flask than if you just checkout a partcular GIT Branch in the repository. Still, if you prefer to just look at the code and not type it in, you will appreciate the source code.


We think the book is fantastic. It was easy to read and got right to the point. We focused mainly on the fundamentals in Part I and skimmed through Parts II and III. Our next goal is to build a mini blog engine using Flask for kicks and then spend more time on building Flask web applications using the "Large Application Structure" introduced in Chapter 7.

Learn more about Flask Web Development, Developing Web Application with Python on the O'Reilly Website.