All configuration for Hábito. lives inside theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/BrandonCVale/SISTEMA-HABITOS/llms.txt
Use this file to discover all available pages before exploring further.
create_app() application factory in app/__init__.py. There is no separate config class, .env file, or environment variable loading in the current codebase — every value is set directly on app.config before any extension is initialised. This is a straightforward setup appropriate for development; see the Production Considerations section for recommended changes before deploying.
Application Settings
The following keys are set onapp.config inside create_app().
'sistema_habitos_76Fu-39+' — Flask uses this key to cryptographically sign the session cookie and the data passed through flash(). Any tampering with the cookie will be detected because the signature will not match.Production requirement: This value must be replaced with a long, unpredictable random string before deploying. See Production Considerations.'sqlite:///habitos.db' — Instructs Flask-SQLAlchemy to use a SQLite database. The three-slash (///) path is relative to the Flask application’s instance path, which resolves to the app/ directory. The habitos.db file is created automatically by db.create_all() in main.py on first run.False — Disables Flask-SQLAlchemy’s object modification tracking event system. This system has significant overhead and is not needed by Hábito., so it is explicitly turned off. Flask-SQLAlchemy emits a deprecation warning if this key is not set.True (development default) — When True, SQLAlchemy prints every SQL statement it generates to the console (stdout). This is extremely helpful for understanding what the ORM is doing and for debugging slow queries during development.Production requirement: Must be set to False in production. See Production Considerations.app/__init__.py:
Flask-Login Settings
Afterlogin_manager.init_app(app) is called, three attributes are configured on the LoginManager instance:
'auth.inicio_sesion' — The endpoint name (Blueprint + function name) that Flask-Login redirects unauthenticated users to when they attempt to access a @login_required route. Uses Flask’s url_for() internally, so the value must match the registered Blueprint name and view function exactly.'Por favor inicia sesión para acceder.' — The message that Flask-Login automatically flashes when it redirects an unauthenticated visitor to the login page.'error' — The flash category applied to the login_message above. Matches the "error" category used throughout the rest of the app so the template renders it with the same error styling.create_app():
Development Server
main.py is the entry point for the development server. It creates the app, ensures all tables exist, and starts Flask’s built-in Werkzeug server:
| Option | Value | Effect |
|---|---|---|
debug | True | Enables the Werkzeug interactive debugger and automatic reloader on code changes |
host | '0.0.0.0' | Binds to all network interfaces, making the server reachable from other devices on the same LAN (e.g. testing on a phone) |
port= argument is given is 5000, so the app is reachable at http://localhost:5000 during development.
Production Considerations
The current configuration is intentionally simple for a development environment. Before deploying to any internet-facing server, address all of the following points.Recommended production-safe create_app() pattern
Use os.environ.get() to read sensitive values from the environment at runtime. This keeps secrets out of the source code entirely.
Dependencies
All packages are pinned inrequirements.txt. The table below lists the packages directly used by Hábito. with their pinned versions and roles.
| Package | Version | Purpose |
|---|---|---|
Flask | 3.1.3 | Core web framework — routing, request/response, templates, sessions, flash |
Flask-SQLAlchemy | 3.1.1 | SQLAlchemy integration for Flask — provides the db object and db.Model base |
Flask-Login | 0.6.3 | Session-based user authentication — @login_required, login_user(), logout_user(), current_user |
bcrypt | 5.0.0 | Password hashing — bcrypt.hashpw() and bcrypt.checkpw() used in UsuarioRepository |
plotly | 6.8.0 | Interactive progress charts rendered in visualizar_progreso.html |
pandas | 3.0.3 | Data manipulation used by EstadisticasService to build the chart data frame |
SQLAlchemy | 2.0.49 | ORM and query engine — underpins Flask-SQLAlchemy; provides Mapped, mapped_column, db.select() |
Jinja2 | 3.1.6 | HTML templating engine bundled with Flask — renders all .html templates |
Werkzeug | 3.1.8 | WSGI utilities bundled with Flask — handles request parsing, static files, and the dev server |
requirements.txt (blinker, click, colorama, itsdangerous, MarkupSafe, etc.) are transitive dependencies pulled in automatically by Flask and its extensions.