-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
47 lines (33 loc) · 1.14 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from flask import Flask, render_template, request, send_from_directory
import algorithm
app = Flask(__name__)
@app.route("/")
def root():
return render_template("index.html")
@app.route("/css/<path:path>")
def serveCSS(path):
return send_from_directory("static/css", path)
@app.route("/js/<path:path>")
def serveJS(path):
return send_from_directory("static/js", path)
@app.route("/", methods=["GET", "POST"])
def aver():
if request.method == "POST":
print(request.form)
origen = request.form["airportO"]
destino = request.form["airportD"]
origen = int(origen)
destino = int(destino)
# return destino + " " + origen
path = algorithm.paths(origen, destino)
# return app.send_static_file('/no/index3.html')
return render_template(
"routes.html", data={"path": path, "origen": origen, "destino": destino}
)
# @app.route("/paths/<int:s>/<int:t>")
# def paths(s, t):
# return app.response_class(
# response=algorithm.paths(s, t), status=200, mimetype="application/json"
# )
if __name__ == "__main__":
app.run(debug=True)