1,自定义视图和蓝图代码
# custom_views.py
from flask import Blueprint, jsonify
custom_bp = Blueprint("custom_bp", __name__)
@custom_bp.route("/custom-endpoint", methods=["GET"])
def custom_endpoint():
return jsonify({"message": "This is a custom endpoint"})
2,在 create_app
中注册蓝图(superset目录下app.py):
3,直接重启 Superset 服务:
在浏览器中访问的 URL http://127.0.0.1:8088/api/custom-endpoint