Flask is a web framework in Python that simplifies the development of web applications. Here are the key points about Flask based on the provided sources:

  • Microframework: Flask is known as a microframework, which means it is designed to be simple and extensible. It provides a small and easy-to-extend core without including features like an ORM (Object Relational Manager). This simplicity allows developers to make decisions on aspects like database usage and ORM, giving them more control over the application’s structure
  • Features: Flask offers essential features like URL routing and a template engine. It is a WSGI web app framework, built on the Werkzeug WSGI toolkit and the Jinja2 template engine. Werkzeug provides request and response objects, while Jinja2 is a popular template engine that allows dynamic rendering of web pages by combining templates with data sources
  • Ease of Use: Flask is considered very Pythonic, making it easy to get started with due to its minimal learning curve. It is explicit and readable, requiring only a few lines of code to create a basic “Hello World” application. Flask’s simplicity and flexibility make it a popular choice for web development, especially for beginners and small to medium projects.
from flask import Flask
from flask import render_template
from flask import request
 
from flask import Flask, redirect, url_for, request
app = Flask(__name__)
 
@app.route('/dashboard/<name>')
def dashboard(name):
   return 'welcome %s' % name
 
@app.route('/login',methods = ['POST', 'GET'])
def login():
   if request.method == 'POST':
      user = request.form['name']
      return redirect(url_for('dashboard',name = user))
   else:
      user = request.args.get('name')
      return render_template('login.html')
 
if __name__ == '__main__':
   app.run(debug = True)