How trananhkiet-hub/cs2401 works
This is a small Flask sales-catalog app. A visitor opens the catalog, where the route loads categories, filters its in-memory product list by an optional keyword, and renders the page; visitors can also open login and registration forms, whose POST handlers redirect without implementing authentication or persistence. Category records are represented by a SQLAlchemy model and loaded through a DAO. The sampled code does not show product persistence, and the database connection is configured for MySQL. Templates are represented by their existing directory; relationships are based on the sampled route and model code.
Main entry points: index.py Catalog and forms · dao.py Category DAO · __init__.py SQLAlchemy setup · models.py Category model
Components 9
Web routes
- Catalog and forms
saleapp/eapp/index.py
Category data
- Category DAO
saleapp/eapp/dao.py - Category model
saleapp/eapp/models.py - SQLAlchemy setup
saleapp/eapp/__init__.py
Page templates
- Catalog page
saleapp/eapp/templates/index.html - Login page
saleapp/eapp/templates/login.html - Registration page
saleapp/eapp/templates/register.html
Other components
- Visitor
- MySQL database
Connections 8
- Visitor → Catalog and forms: requests pages
saleapp/eapp/index.py - Catalog and forms → Category DAO: loads categories
saleapp/eapp/index.py - Category DAO → Category model: queries
saleapp/eapp/dao.py - SQLAlchemy setup → MySQL database: configures connection
saleapp/eapp/__init__.py - Category DAO → MySQL database: reads categories
saleapp/eapp/dao.py - Catalog and forms → Catalog page: renders
saleapp/eapp/index.py - Catalog and forms → Login page: renders
saleapp/eapp/index.py - Catalog and forms → Registration page: renders
saleapp/eapp/index.py