• JAVA日报


    双人结对作业疫情可视化(flask)

    from flask import Flask, jsonify, render_template, request, json

    import MysqlUtil

    app = Flask(__name__)


    @app.route("/")
    def hello():
    return render_template('TEXT.html')


    @app.route("/q1")
    def hellp():
    return "helloworld"


    @app.route("/c2")
    def get_province():
    res0 = []
    res1 = []
    res2 = []
    res3 = []
    for tup in MysqlUtil.get_province():
    res0.append({"name": tup[0], "value": int(tup[1])})
    res1.append({"name": tup[0], "value": int(tup[2])})
    res2.append({"name": tup[0], "value": int(tup[3])})
    res3.append({"name": tup[0], "value": int(tup[4])})
    return jsonify({"confirm": res0, "suspect": res1, "heal": res2, "dead": res3})


    @app.route("/c3", methods=['POST', 'GET'])
    def get_area():
    res0 = []
    res1 = []
    res2 = []
    res3 = []
    name = request.form.get("name")
    for tup in MysqlUtil.get_area(name):
    res0.append({"name": tup[0]+"市", "value": int(tup[1])})
    res1.append({"name": tup[0]+"市", "value": int(tup[2])})
    res2.append({"name": tup[0]+"市", "value": int(tup[3])})
    res3.append({"name": tup[0]+"市", "value": int(tup[4])})
    return jsonify({"confirm": res0, "suspect": res1, "heal": res2, "dead": res3})


    if __name__ == '__main__':
    app.run(debug=True, host='127.0.0.1', port='5000')
  • 相关阅读:
    初学C#线程
    初学C#线程二
    JQuery Ajax
    算法测试
    个人报告
    202120221课程设计第三周进展
    socket测试3
    202120221课程设计任务理解与分工
    嵌入式基础
    202120221课程设计第四周进展
  • 原文地址:https://www.cnblogs.com/mumulailai/p/14911454.html
Copyright © 2020-2023  润新知