FLASK – a micro web framework for python

Introduction

Flask is a micro web framework for python. It is based on Werkzeug and Jinja. it was developed by Armin Ronacher in 2004. It’s called a microframework as it’s not required any tool or library.

Why Flask

Flask is more suitable for python project as it’s easy to learn for a beginner. It is designer in such a manner so that it can easily use and extend. It’s a very lightweight microframework to create python web applications.

Components

  • Werkzeug
  • Jinja

Features

  • Easy to use and extensible
  • Templating
  • Development server and debugger
  • Support secure cookies
  • Support unit testing
  • Unicode based
  • Lightweight

Example

from flask import Flask
app = Flask(__name__)

@app.route("/")
def home():
 return "Home Page"

@app.route("/about")
def about():
return "About Page"

@app.route("/contact")
def contact():
return "Contact Page"

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