Python/Brythonでフロントエンド実装BMI

app.py
import os
from flask import Flask, request

app = Flask(__name__)

@app.route('/')
def index():
    return app.send_static_file('index.html')

if __name__ == '__main__':
    app.run(host="0.0.0.0", debug=True)
	
static/bmi.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from browser import document

def calc_bmi():
    weight = float(document["weight"].value)
    height = float(document["height"].value)
    
    bmi = str(weight/(height*height))
    rslt = document["result"]
    rslt.text = bmi
    
execute_btn = document["execute"]
execute_btn.bind("click", calc_bmi)
	
static/index.html

html>
    head>
        title>BrythonでBMIを計算する/title>
        meta charset="utf-8">
        script src="static/brython.js">/script>
	script src="static/brython_stdlib.js">/script>	
    /head>
    body onload="brython()">
        script type="text/python" src="static/bmi.py">/script>
        h1>BrythonでBMIを計算する/h1>

	p>身長(メートル)
	input type="text" id="height" />
	p>体重(キログラム)
	input type="text" id="weight" />
        br>button id="execute">計算だ!/button>

	div id="result">/div>
    /body>
/html>