DEV Community

Cover image for What is Flask used for?
amigos-maker
amigos-maker

Posted on

What is Flask used for?

Flask is a lightweight Web Server Gateway Interface WSGI web application 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 Werkzeug and Jinja2 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.

These frameworks for Python comes in different ways, owned and created by different people. Examples are; Flask, Tornado, Django, e.t.c.

You should learn Python, 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.

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 develop a web application, 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.

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 Werkzeug a WSGI utility library and Jinja2 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 create a web app with flask 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.

The Flask framework which is lightweight and is known as a microframework can also be used to create social networks, blogging platforms, hackers news clones, 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:

Latest comments (0)