1 - About Flask Framework

Flask is an open-source Python web development framework. Its main goal is to be light, in order to keep the flexibility of Python programming, associated with a system of templates. It is distributed under the BSD license.
Flask was originally created by Armin Ronacher as an April Fool's . Ronacher's wish was to create a web framework contained in a single Python file but able to maintain high demand applications.

In 2018, Flask was voted "Most Popular Web Framework" by the Python Developers Survey. As of January 2020, it had over 49,000 stars on Github, more than any other Python web development framework.

2 - Features

Flask is based on two modules werkzeug and jinja to offer several of the following features:

  1.     Development server and debugger
  2. Simplifies writing unit tests
  3. Template engine for HTML  rendering
  4. Supports secure cookies (session) 
  5. Fully compatible with WSGI
  6. Based on Unicode
  7. Complete documentation
  8. Easy deployment on multiple hosts
  9. Adding functionalities via extensions

3 - Install Flask Framework

Install Flask Flask Framework can be installed easily and quickly by using the pip command: Flask:

pip install Flask

4 - First program Hello World with Flask

The basic program for using Flask is:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
return "Hello world !"

if __name__ == "__main__":
app.run()

After execution you will see this message:

   Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Then by typing the the url : http://127.0.0.1:5000/  in your browser you will see the "Hello World !" message:

Younes Derfoufi
my-courses.net

Leave a Reply