-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
50 lines (36 loc) · 1.37 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
48
49
50
from flask import Flask, render_template, request
from aeroroute import aeroroute_input
app = Flask(__name__)
# @app.route('/')
# def index():
# # Call the main function from aeroroute.py
# query = ("KJFK", "EGLL")
# result = aeroroute_input((query))
# # Return the result as a response
# #return str(result)
# # Render the index.html template and pass the result to it
# return render_template('index.html', query=query, result=result)
# #return f"Result from aeroroute.py: {result}"
# @app.route('/', methods=['GET', 'POST'])
# def index():
# if request.method == 'POST':
# route = request.form.get('route').upper()
# query = (route.split())
# result = aeroroute_input(query)
# return render_template('result.html', route=route, result=result)
# return render_template('form.html')
# if __name__ == '__main__':
# app.run(debug=True)
from flask import Flask, render_template, request
from aeroroute import aeroroute_input
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
route = result = None
if request.method == 'POST':
route = request.form.get('route').upper()
query = route.split()
result = aeroroute_input(query)
return render_template('form.html', route=route, result=result)
if __name__ == '__main__':
app.run(debug=True)