How dagus21/proyecto_apg works
Project type and purpose
• Proyecto APG is a monolithic, full-stack web application built with Flask.
• Purpose: Provide modular, reusable authentication features (login, registration, email verification, password recovery).
High-level file-structure analysis
• app.py: Main Flask application entrypoint. Likely registers Blueprints for each feature.
• Clases_Base/: Core data-access layer (DB connection & generic CRUD for user details).
• Gestion_y_Autenticacion_Login/: Blueprint handling login, registration, change-password and email verification. Contains its own main.py, business logic (GestionLogin.py), static assets, templates, and tests.
• Recuperacion_y_Cambio_Contrasena/: Blueprint for password recovery and reset. Includes main.py, helpers, templates, and tests.
• Front/ + static/ + templates/: Shared CSS, JS, and base/layout HTML templates used across all modules.
• log.py: Centralized logging setup (outputs to APG.log or sistema.log).
• .env & requirements.txt: Environment and dependency definitions.
• tests & allure-results: Pytest test suites and Allure reports (not part of runtime, but useful to show CI/testing layer).
Key README insights
• Modular, “feature-oriented” architecture. Each major function (login, recovery) is a self-contained Flask Blueprint with its own assets & tests.
• Uses Flask, SQLAlchemy (via psycopg2), bcrypt for password hashing, flask-mail for email, pytest + allure-pytest for testing & reporting.
Main components
a. Client Layer
• Web browser (end user)
• Delivers HTTP(S) requests, renders HTML/CSS/JS
b. Presentation/Web Layer
• Flask App (app.py)
• Blueprints:
– Gestion_y_Autenticacion_Login
– Recuperacion_y_Cambio_Contrasena
• Shared Front assets (Front/, static/, templates/)
c. Business Logic Layer
• GestionLogin.py & helpers.py (module-specific controllers/services)
• Clases_Base (Conexion_Data_Base, Crud_Usuario_Detalle)
• log.py for logging events
d. Data Layer
• PostgreSQL (accessed via SQLAlchemy/psycopg2)
e. External Services
• SMTP Mail Server (flask-mail) for verification & recovery emails
• Optional: CI/Test Runner producing Allure reports
Relationships & data flows
• Browser → Flask App (HTTP request)
• Flask App routes to correct Blueprint → invokes module controller (main.py → GestionLogin or helpers)
• Controller → Clases_Base → SQLAlchemy → PostgreSQL (DB queries)
• Controller → flask-mail → SMTP (send email)
• Controller → Renders Jinja2 templates → returns HTML to browser
• log.py intercepts key events → writes to log files
• pytest runners → exercise each module’s tests → produce Allure JSON → served by Allure UI
Architectural patterns & design principles
• Modular/Feature-Oriented: each functional area is a self-contained Blueprint.
• Layered Architecture: Presentation (Flask + static/templates) → Business Logic (controllers, services) → Data Access (Clases_Base) → Data Store (PostgreSQL).
• Separation of Concerns:
• Static vs. Template assets separated per module & shared layer.
• Tests co-located with modules.
• Logging abstracted to log.py.
• Reusability: Common templates and static files in Front/, static/, templates/.
Detail level
• Reusable modules: Front, static, templates
• Tests & CI only if diagramming testing architecture (optional inset)