vi static/hello.js

function sayHello() {
   alert("Hello. :)")
}
vi templates/hello.html
<html>
   <head>
      <script type = "text/javascript"
         src = "{{ url_for('static', filename = 'hello.js') }}" ></script>
   </head>

   <body>
      <input type = "button" onclick = "sayHello()" value = "Say: Hello" />
   </body>
</html>
vi hello.py
from flask import Flask, render_template
ap = Flask(__name__)

@ap.route("/hello")
def index():
   return render_template("hello.html")

if __name__ == '__main__':
   ap.run(host='0.0.0.0')