What is Flask?
Flask is web Framework that provides libraries to build lightweight web applications in python.It is develpped by ARMIN Ronacher who leads an international group of python enthusiasts(POCCO). It is based on WSGI toolkit and jinja2 template engine.Flask is considered as a micro framework.
Features of Flask
- Built-in development server and fast debugger.
- Integrated support for unit testing
- Jinja2 templating
- Support for secure cookies(clinet side sessions)
- WSGI 1.0 compliant
- Unicode based
Prerequisite
Before learning Flask, you must have the basic knowledge of python concepts and HTML , CSS.
Flask Installation:
Python flask is a external module so for working on it we first have to install it using command.
#open cmd command and run this pip install flask
Hello world Program
from flask import Flask #creating the Flask class object app = Flask(__name__) @app.route('/') def home(): return "Hello world !"; if __name__ == '__main__': app.run()
Console Output:
URL: http://127.0.0.1:5000/