import os from flask import Blueprint, jsonify, send_from_directory, current_app as app home_bp = Blueprint("home", __name__) @home_bp.route('/') def serve_root(): return send_from_directory(app.static_folder, 'index.html') @home_bp.route('/') def serve_spa(path): if os.path.exists(os.path.join(app.static_folder, path)): return send_from_directory(app.static_folder, path) return send_from_directory(app.static_folder, 'index.html')