Category: python
topic 1 introduction to flask and web frameworks
Published on 30 Sep 2026
Explanation
Flask is a lightweight Python web framework used to build web applications and REST APIs.
Code:
from flask import Flask app = Flask(__name__)
Explanation
A web framework provides features such as routing, request handling, responses, templates, and application configuration.
Code:
Client | v Web Framework | +-- Routing +-- Request Handling +-- Business Logic +-- Response | v Client
Explanation
Flask follows a minimal approach, allowing developers to add only the extensions and components required by the application.
Code:
Flask | +-- Flask-SQLAlchemy +-- Flask-JWT-Extended +-- Flask-Migrate +-- Marshmallow
Explanation
Flask applications can be used for both server-rendered web applications and REST APIs.
Code:
Browser → Flask → Jinja2 → HTML Mobile / React → Flask → JSON REST API
Explanation
The Flask development server can be started directly from Python or using the Flask command-line interface.
Code:
flask --app app run --debug # Default URL http://127.0.0.1:5000