-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from derekm1986/development
Development
- Loading branch information
Showing
7 changed files
with
185 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ AIRAC/ | |
*.pyc | ||
.idea/ | ||
__pycache__/ | ||
routes/ | ||
aeroroute.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Flask==1.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
flex-direction: column; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h2>Aeroroute Distance Tool</h2> | ||
|
||
<form action="/" method="post" style="display: flex; flex-direction: column; align-items: center;"> | ||
Route:<br><br> | ||
<textarea name="route" style="width: 400px; height: 50px;">{{ route }}</textarea> | ||
<br><br> | ||
<input type="submit" value="Submit"> | ||
</form> | ||
|
||
{% if result %} | ||
<h2>Result</h2> | ||
<p>{{ result }}</p> | ||
{% endif %} | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Aeroroute</title> | ||
</head> | ||
<body> | ||
<h1>Welcome to Aeroroute!</h1> | ||
<p>Query was</p> | ||
<p>{{ query }}</p> | ||
<p>Result was</p> | ||
<p>{{ result }}</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<h2>Result</h2> | ||
|
||
<p>Route: {{ route }}</p> | ||
<p>Result: {{ result }}</p> | ||
|
||
</body> | ||
</html> |