How akboxer/sacdap_clean works
Project Type and Purpose
• This is a full-stack web application built with Flask (Python).
• It serves a static-dynamic website for a coaching institute, providing course PDFs, contact/enrollment forms, and admin views.
File-Structure Analysis
• Top-Level Python Modules:
• app.py / app_instance.py – entry point and Flask app factory
• main.py, routes.py – HTTP routes (controllers)
• forms.py – WTForms definitions (form models)
• data.py – data layer (course/catalog info, could be abstracted as the “model”)
• Templates (Jinja2 View Layer):
• templates/*.html – page layouts, base.html, home, contact, admin panels
• Static Assets:
• static/css, static/js – styling and client-side behavior
• static/images – brand, slide show
• static/pdfs – course material library
• Environment & Configuration:
• requirements.txt / pyproject.toml – Python dependencies
• venv – local Python environment
• No external database configured, implying flat file or in-memory data for now
Key Architectural Patterns
• MVC-style separation:
• Model: data.py (course data), forms.py (form schema)
• View: Jinja2 templates under templates/
• Controller: Flask route handlers in routes.py/main.py
• Static resource serving via Flask or fronted by a web server (Nginx) in production
• Optional: Email/SMTP service for contact form submissions (not explicitly coded)
A. Client (Browser)
– Sends HTTP(S) requests for pages, assets, form submissions
B. Reverse Proxy / Web Server (optional production layer)
– Nginx/Apache: handles SSL, static file caching, forwards dynamic requests to WSGI
C. WSGI Application Layer
– Gunicorn/uWSGI running the Flask app
– app_instance.py constructs Flask instance, routes.py defines endpoints
D. Flask Components
1. Routing/Controllers: map URLs to handlers
2. Forms Module: validate and process enrollment/contact data
3. Data Module: provides course/catalog data to views
4. Template Engine (Jinja2): renders HTML with dynamic data
E. Static File Server
– Serves CSS, JS, images, PDFs directly (either by Flask in dev or by Nginx in prod)
F. External Services (optional)
– Email/SMTP service for form notifications
– Analytics or monitoring (if added)
Relationships & Data Flows
• Browser → HTTP GET / POST → Nginx → Gunicorn → Flask route
• Route handler fetches data from data.py or processes forms via forms.py
• Flask injects data into templates → Jinja2 → HTML response → Client
• Static asset requests bypass Flask logic (direct serve)
• Form POST → Flask → Validate → (Email service or store) → Redirect to success page