How vishalla/week7_ga works
Project Type and Purpose
• This is a full-stack Python Flask web application for managing courses, students, and enrollments.
• It serves both HTML pages (server-rendered via Jinja2 templates) and offers a JSON/REST API under the “applications/API” module.
High-Level Components
a. Presentation Layer
• app.py (root) – Flask application entry point, registers routes/blueprints.
• templates/ – Jinja2 HTML templates for pages (create/update/index/student_exists, etc.).
• static/styles.css – CSS styling served by Flask’s static folder.
b. API Layer
• applications/API/*.py – Flask Blueprints or route modules for course_API, student_API, enrollment_API.
• validation.py – Input validation logic before controller invocation.
c. Controller Layer
• applications/controllers/*.py – Business-logic controllers (coursecontrollers.py, studentcontrollers.py) handling CRUD flows.
d. Model & Data Access
• applications/model.py – ORM-style data models or entity definitions.
• applications/database.py – Database connection manager, session handling.
• week7_database.sqlite – SQLite file housing data.
e. Configuration
• applications/config.py – Configuration settings (DB URI, debug flags, etc.).
f. Requirements & Scripts
• req.txt – Python dependencies (Flask, etc.).
• instructions.txt / Week7_LA.pdf – Project guidelines and assignment doc.
Relationships & Data Flows
• Browser ⇄ Flask app:
• User submits form or clicks link → HTTP request to app.py routes.
• app.py dispatches to either API Blueprint (JSON end points) or controller endpoints (render templates).
• API Layer → Validation → Controllers:
• API module receives JSON payload, calls validation.py → passes to controllers for business logic.
• Controllers → Model & DB:
• Controller invokes model.py classes and uses database.py session to read/write to SQLite.
• Controllers → Templates:
• For HTML views, controller returns data to Jinja2 templates which generate HTML → sent back to Browser.
Architectural Patterns & Principles
• MVC-style separation:
• Models (applications/model.py + DB),
• Views (templates/ + static),
• Controllers (applications/controllers).
• Layered architecture:
Presentation → API/Validation → Business Logic → Data Access.
• Single-source config via applications/config.py.
• SQLite as embedded DB for simplicity.