from flask import Flask, jsonify, render_template,request import json app = Flask(__name__) @app.route('/api/config') def get_config(): with open('cfg.json', 'r', encoding='utf-8') as f: config = json.load(f) return jsonify(config) @app.route('/') def index(): return render_template('index.html') @app.route('/saveForm', methods=['POST']) def submit(): username = request.json.get('name') password = request.json.get('email') # 执行提交逻辑 print(username,password) return jsonify({"code": 0, "msg": "恭喜,注册成功!"}) if __name__ == '__main__': app.run()