HOLIDAY SALE! Save 50% on Membership with code HOLIDAY50. Save 15% on Mentorship with code HOLIDAY15.

2) What exactly is Flask? Lesson

What is the Flask Microframework?

7 min to complete · By Brandon Gigous

What is Flask?

Flask is a Python framework that allows Python developers to quickly build robust and scalable web applications. Flask is often referred to as a microframework, because it does not require particular tools or libraries. Keep reading below to learn about microframeworks and common uses for Flask.

What is a microframework?

Before answering that question, let's first talk about web apps in general and how they work.

Many of the web apps you have probably used are full-fledged web apps with user authentication, forms with input validation, and database access. These are called full-stack frameworks, and are used by large enterprises like Twitter and Microsoft. These frameworks have both the frontend--what the user sees and interacts with--and a backend, which does all the work behind the scenes including data access.

In short, "microframework" really just means "minimalistic web application framework." A microframework is much simpler than a full-stack framework in that it does one thing and it does it very well, and that is to provide a server that users can access just like they would any other website, i.e. get a request from the user and return a response. However, these frameworks don't have all the bells and whistles like user authentication or a fancy user interface.

But for a developer like yourself, this is actually great news. With a microframework, you have full control over your app. You get to pick how the users will login, the inputs they can use, and which underlying database technology to use, all built around the microframework. It makes build a web app easy, but also allows you to scale up easily to provide more complex functionality.

Think of a microframework as a flat LEGO base plate and the basic rectangular bricks that might come with a set.

people building a structure with legos

You can put bricks on it, you can take bricks off of it, and you can build an ugly multicolored house; you have the basics to build basic things right off the bat. Now the fun begins when you get sets like knights and castles, spaceships and astronauts, or cowboys. You could just use one set on that base plate, or you could combine any or all of them as you want, like knights fighting cowboy astronauts in galactic castles.

Background and Usage of Flask

While Flask is a very popular microframework, it actually started out as an April Fool's Joke. Armin Ronacher took that joke as a challenge and so began a journey that has made Flask what it is today. It's become so popular, in fact, that it's been used by websites such as:

  • Pinterest uses Flask to power their API
  • LinkedIn has used Flask for their internal stack
  • Twilio for their public and private API
  • Apache Airflow uses Flask as a significant portion of its code
  • Plotly's Dash tool uses Flask as a backend
  • Patreon
  • Heck, even former US President Obama's campaign team used it for his 2012 campaign website

Why use Flask?

So why would these websites, or really any website, want to use Flask? As was discussed in the previous lesson, Flask is a microframework, and microframeworks are simple but powerful. With Flask, you can get a basic website up and running right away, all within a single Python script. If you want to expand its capabilities and you're picky (or not) about what technologies you want to use, that's no problem either because Flask does not make any decisions for you. If you want to use a relational database for your underlying website data, you can choose any kind, or even if you want a NoSQL database like MongoDB, that's fine, too! It doesn't just stop at databases, either.

You might be thinking, "I thought you said Flask and microframeworks could only do one thing!" And you would be correct. While Flask doesn't do anything else but provide a basic server, there are oodles and oodles of open-source Flask extensions that can probably get most if not all of the functionality you might want in your application. You'll go over a few of them in this course.

Summary: What is Flask?

  • Flask is a Python microframework for building web applications. You'll spend this whole course learning the ins and outs of Flask along with a few of these "bells and whistles" that allow us to build a pretty cool app.
  • Flask started as an April fools joke.
  • Flask is used by many large enterprises around the world.
  • Flask is simple and allows you to get a website up and running right away.