Major Refactor: Refactor the codebase to improve readability and maintainability

This commit is contained in:
2026-06-21 23:38:49 -04:00
parent 9c4753cd1f
commit 801b0b97fc
46 changed files with 2378 additions and 2031 deletions

22
app.py
View File

@@ -1,12 +1,20 @@
import os
from flask import Flask
from database import init_db
from routes_auth import register_auth_routes
from routes_worker import register_worker_routes
from routes_admin import register_admin_routes
from models.models import db
from routes.auth_bp import auth_bp
from routes.worker_bp import worker_bp
from routes.admin_bp import admin_bp
app = Flask(__name__)
app.secret_key = "super_secret_dev_key"
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{os.path.join(basedir, "db", "rendiciones.db")}'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)
@app.after_request
def add_header(response):
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
@@ -14,10 +22,10 @@ def add_header(response):
response.headers["Expires"] = "0"
return response
register_auth_routes(app)
register_worker_routes(app)
register_admin_routes(app)
app.register_blueprint(auth_bp)
app.register_blueprint(worker_bp)
app.register_blueprint(admin_bp)
if __name__ == '__main__':
init_db()
app.run(host='0.0.0.0', port=5000, debug=True)
app.run(host='0.0.0.0', port=5000, debug=True)