What is Flask used for?
Tags: python, flask
Published: 2019-11-16 13:19:41

---
title: What is Flask used for?
tags: python, flask
cover_image: https://cdn.pixabay.com/photo/2019/03/02/21/07/birds-4030704_960_720.png
published: true
---
<a href="https://flask.palletsprojects.com/">Flask</a> is a lightweight <a href="https://wsgi.readthedocs.io/en/latest/learn.html">Web Server Gateway Interface WSGI web application</a> framework that was created to make getting started easy and making it easy for new beginners. With the tendency to scale up to complex applications. 

Flask has its foundation around <a href="https://pypi.org/project/Werkzeug/">Werkzeug</a> and <a href="https://jinja.palletsprojects.com/en/2.10.x/">Jinja2</a> and has become one of the most popular Python web application frameworks.

As a developer in developing a web app in python, you may be using a framework to your advantage. A framework is a code storage that should help developers achieve the required result by making work easier, scalable, efficient and maintainable web applications by providing reusable code or extensions for common operations. 

<img src="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fimages.amcnetworks.com%2Fifc.com%2Fwp-content%2Fuploads%2F2015%2F07%2FOmar-the-Wire-Code.gif&f=1&nofb=1">

These frameworks for Python comes in different ways, owned and created by different people. Examples are; <a href="https://flask.palletsprojects.com/">Flask</a>, <a href="https://www.tornadoweb.org/">Tornado</a>, <a href="https://www.djangoproject.com/">Django</a>, e.t.c.

You should <a href="https://pythonbasics.org">learn Python</a>, before trying to make web apps.

## Why Flask

Flask gives the developer varieties of choice when developing web applications, it provides you with tools, libraries, and mechanics that allow you to build a web application but it will not enforce any dependencies or tell you how the project should look like. 

<img src="https://s2.qwant.com/thumbr/0x380/6/5/6fe4a42b4de597ddc618456ac8ee8457e57445c8708f5e1afe579201a97ff8/cb1.jpg?u=http%3A%2F%2Fmrjoes.github.io%2Fshared%2Fposts%2Fflask-admin-120%2Fcb1.jpg&q=0&b=1&p=0&a=1">

The web application can be a blog, commercial website or some web pages, it still allow the developers the opportunity to use some extensions provided by the community that allows you to add more functionality to the web application.

# Pros and cons

As earlier stated, the flask is categorized as a micro or lightweight framework. Usually, a micro-framework is a framework with minimal or no dependencies on external libraries. In any case, as a developer use the framework called flask to <a href="https://pythonspot.com/flask-web-app-with-python/">develop a web application</a>, it has its advantages and disadvantages. 

Some of the good things that come with using flask as your framework to develop the web application is little dependency to update and be on the lookout for security bugs.

<img src="https://s1.qwant.com/thumbr/0x0/0/6/8d14131e4857cc2f295052ced19719e680ae5dfde2d446deb35996527343d3/pro-con-list.gif?u=http%3A%2F%2Fwww.mollysbooknook.com%2Fwp-content%2Fuploads%2F2017%2F01%2Fpro-con-list.gif&q=0&b=1&p=0&a=1">

While a disadvantage of using flask is that sometimes you end up doing more work for yourself or increase the list of dependencies by yourself by adding extension. 

Flask is based on <a href="https://pypi.org/project/Werkzeug/">Werkzeug</a> a WSGI utility library and <a href="https://jinja.palletsprojects.com/en/2.10.x/">Jinja2</a> which is its template engine. You can use this web application framework to compile modules and libraries which will also help the developer to write web applications without writing low-level code like thread management and protocols.

## How it works

First <a href="https://pythonbasics.org/flask-tutorial-hello-world/">create a web app with flask</a> and connect it to HTML. Anytime any user sends information on the net or goes to the search bar, the HTML connects the user. The flask framework looks for HTML files (templates) in a folder called Templates. Before sending the template over, Python code is executed which injects variables, code etc.

<img src="https://thepracticaldev.s3.amazonaws.com/i/gr0aggu8q77aetp4pw1q.gif" width="30%">

<a href="https://flask.palletsprojects.com/">The Flask framework</a> which is lightweight and is known as a microframework can also be used to create social networks, <a href="https://github.com/dmaslov/flask-blog">blogging platforms</a>, <a href="https://news.ycombinator.com">hackers news clones</a>, normal content sites, and many more. With flask and its features, you can do almost everything as a developer but if you are planning to build a bulky and heavy load web application, I will advise you choose some other web framework, as the flask is a micro framework.

Finally, the flask is a micro framework basically used to build web applications and has its own features.

**Related links:**
* <a href="https://palletsprojects.com/p/flask/">Flask web framework</a>
* <a href="https://pythonbasics.org/flask-tutorial-hello-world/">Flask beginners tutorial</a>
* <a href="https://pythonbasics.org/">Learn Python</a>