Introduction to Python & Flask
Explanation of the Flask framework and how a Flask app works
The Flask framework
If we don’t understand what we are dealing with, it will be difficult to troubleshoot the problems we have going forward.
Let’s understand some terminologies used in Python:
Modules
In short, imports in Python allow us to use pre-coded classes and functions with just one line of the statement. The import keyword is used to access code written in modules. eg. from <modulename> import <class>
In our code, the first line in app.py is:
from flask import Flask, render_template, request, redirect
This imports the Flask class from the Flask module and different other functionalities.
Routes
Frameworks encapsulate the response mechanism in routes. To access a particular resource, we need a particular URI/address. Routes provide the facility to deliver functionality at a particular endpoint without creating ...