Intro to Flask Concepts
Learning objective: By the end of this lesson, students will be able to describe Flask’s characteristics in the web framework ecosystem.
What is Flask?
Flask is a micro web framework developed in Python by Armin Ronacher.
Designed with a do-it-yourself philosophy, Flask is a non-intrusive web framework similar to Express that allows you to make design decisions based on your applications needs.
Unlike its counterpart Django, which is often seen as having a steeper learning curve, Flask provides a more straightforward approach. Flask allows developers to start projects with a minimalistic initial setup, and the option to expand functionality through numerous extensions.
Despite its simplicity, Flask is robust enough to handle a variety of complex tasks, evidenced by its use in platforms such as:
- Netflix
🏆 Flask’s built-in development server is not meant for production use. Instead, it is typically deployed behind a production-grade web server that communicates through the WSGI (Web Server Gateway Interface) protocol, with Gunicorn being a popular choice.
🗣 WSGI is pronounced whiskey.
Core functionalities of web application frameworks
A web framework is a component designed to support the development of web applications. Essentially, it is a tool representing a collection of libraries and modules that provide a web app developer with the necessary resources to easily develop web applications.
Web Application Frameworks have three capabilities fundamental to writing a back-end web application:
- Routing: Defining routes (URLs) that client applications can make requests to.
- Request Handling: Processing incoming requests, parsing data, and making decisions based on the route and HTTP method.
- Response Generation: Combining data with templates to create dynamic content, or directly sending data as a response to client requests.