Fork me on GitHub

Flask

Flask is a Python web framework built with a small core and easy-to-extend philosophy. Official Flask logo. Flask Artwork License.

Why is Flask a good web framework choice?

Flask is considered more Pythonic than Django because Flask web application code is in most cases more explicit. Flask is easy to get started with as a beginner because there is little boilerplate code for getting a simple app up and running.

For example, here's a valid "hello world" web application with Flask (the equivalent in Django would be significantly more code):

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()

Flask was also written several years after Django and therefore learned from the Python community's reactions as the framework evolved. Jökull Sólberg wrote a great piece articulating to this effect in his experience switching between Flask and Django.

Flask resources

The 18-part Flask mega tutorial is an absolutely amazing starting resource for using the Flask framework. Yes, there are a lot of posts in the series. However, each post is focused on a single topic to contain the complexity while the reader is learning the framework. The whole series is well worth an in-depth read-through. The author also wrote the new O'Reilly Flask Web Development book which is an excellent learning resource.

Open source Flask example projects

Flask framework learning checklist

Install Flask on your local development machine.

Work through the 18-part Flask tutorial listed first under "Flask resources" below.

Read through Flask Extensions Registry to find out what extensions you'll need to build your project.

Start coding your Flask app based on what you learned from the 18 part Flask tutorial plus open source example applications found below.

Move on to the deployment section to get your initial Flask project on the web.

What do you need to learn about web frameworks next?

How do I deploy Flask web application when it's ready to go live?

I'd like to go back to reviewing other web frameworks.

The user interface looks terrible. How do I style my web app?

How can I version and store my source code so I don't lose it?


Interested in a complete Full Stack Python book with detailed tutorials and example code? Sign up here and you'll get an alert email if a book is created. No other emails will be sent other than sign up confirmation.