Flask is an open-source web application development framework developed in Python. Flask is supported by huge developer community. Flask in itself is a micro framework but, it has the ability to integrate with many extensions to help us build robust and scalable applications.
Table of Contents
- Operating Systems Where Flask application runs
- About Flask Web Server
- Most widely used Flask Extensions
- Why Flask?
- Limitations of Flask
- Python Based Alternatives for Flask Framework
Operating Systems Where Flask application runs
A Flask application can be developed and hosted on various Operating Systems like Windows, Mac and all variants of Unix based OS distributions. Flask is also explored and used in Internet of Things and can be served on RaspberryPI and Arduino.
About Flask Web Server
Flask is served by WSGI (Web Server Gateway Interface). WSGI is a strict python based web server that facilitate the running of the Flask application. All it does is serve the requests from client to web application and vice versa.
Most widely used Flask Extensions
Flask with its powerful extensions allows the space to mission critical applications. Some of the most widely used extensions are werkzeug, gunicorn, jinja, Flask-RESTful and SQLAlchemy to name a few.
werkzeug and gunicorn are WSGI servers to run Flask applications.
jinja is a templating engine to build User Interface for flask based application.
Flask-RESTful extension allows you to implement REST APIs by leveraging the power of Python and Flask framework.
SQLAlchemy is a powerful python module to interface with the Relational databases. SQLAlchemy has two variants. One with Expression Language and another is ORM which in turn is built with Expression Language as the base.
Why Flask?
There are many robust web application development frameworks out there like .NET Based frameworks such as ASP.NET and ASP.NET core, PHP based Laravel, CakePHP, Node based Angular, React, Vue. Even in Python we have Django, Bottle, FastAPI and Sanic frameworks to mention a few.
Each of these frameworks has its own strengths and offers a solution to variety of requirements.
So the question arises, why anyone should choose Flask Micro framework for their next web application development?
The following are the reasons once can choose Flask as the framework to develop the web application:
- Faster development times.
- Easy for quick prototyping of web applications or REST APIs.
- And most importantly, majority of the AI frameworks are developed in Python which facilitates the models to be served via Flask to the outside world.
That’s not all, Flask also helps us develop RESTAPIs. And as usual these can be consumed in any front-end frameworks of your choice like Vue, React or Angular.
Limitations of Flask
The major limitation is the tight coupling with its web server type WSGI. So far it is not compatible with ASGI (Asynchronous Server Gateway Interface) servers like uvicorn.
There is no built-in support for Asynchronous operations. You need to go for asyncio or celery to achieve and hence its not straight forward.
Need to go for gevent to implement web sockets.
Comparatively slower response times in contrast to other frameworks. Benchmarks
Python Based Alternatives for Flask Framework
Apart from Flask, following are the other most popular web frameworks in Python
- Django
- Tornado
- Bottle
- FastAPI
- Sanic
- Starlette
In this tutorial we had a basic understanding of Flask, its web server. And also learnt why one should choose Flask to implement web applications. We saw the limitations of Flask and how Flask extensions will help overcome those limitations. Then we learnt what are the Flask alternative web application frameworks in Python.