Flask (web framework)


Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Extensions are updated far more frequently than the core Flask program.
Applications that use the Flask framework include Pinterest and LinkedIn.

History

Flask was created by Armin Ronacher of Pocoo, an international group of Python enthusiasts formed in 2004. According to Ronacher, the idea was originally an April Fool's joke that was popular enough to make into a serious application.
When Ronacher and Georg Brandl created a bulletin board system written in Python, the Pocoo projects Werkzeug and Jinja were developed.
Flask has become popular among Python enthusiasts., it has more stars on GitHub than any other Python web-development framework, and was voted the most popular web framework in the Python Developers Survey 2018.

Components

The microframework Flask is based on the Pocoo projects Werkzeug and Jinja2.
;Werkzeug:
Werkzeug is a utility library for the Python programming language, in other words a toolkit for Web Server Gateway Interface applications, and is licensed under a BSD License. Werkzeug can realize software objects for request, response, and utility functions. It can be used to build a custom software framework on top of it and supports Python 2.7 and 3.5 and later.
;Jinja:
Jinja, also by Ronacher, is a template engine for the Python programming language and is licensed under a BSD License. Similar to the Django web framework, it handles templates in a sandbox.

Features

The following code shows a simple web application that displays "Hello World!" when visited:

from flask import Flask
app = Flask
@app.route
def hello:
return "Hello World!"
if __name__ "__main__":
app.run