forked from thedataincubator/flask-framework
-
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.
- Loading branch information
Showing
5 changed files
with
30 additions
and
16 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 |
---|---|---|
|
@@ -11,4 +11,6 @@ htmlcov/ | |
|
||
dist/ | ||
build/ | ||
*.egg-info/ | ||
*.egg-info/ | ||
|
||
sandbox/ |
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 |
---|---|---|
@@ -1,14 +1,28 @@ | ||
"""Display a stock ticker visualization based on user input.""" | ||
from flask import Flask, render_template, request, redirect | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
|
||
@app.route('/', methods=('GET', 'POST')) | ||
def index(): | ||
return render_template('index.html') | ||
"""Render the app's main page.""" | ||
if request.method == 'GET': | ||
# Default gives IBM's ticker when first loaded. | ||
symbol = 'IBM' | ||
return render_template('index.html', symbol=symbol) | ||
|
||
else: | ||
# User submitted a ticker symbol aka method = 'POST' | ||
symbol = request.form['symbol'] | ||
return render_template('index.html', symbol=symbol) | ||
|
||
|
||
@app.route('/about') | ||
def about(): | ||
return render_template('about.html') | ||
return render_template('about.html') | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(port=33507) | ||
app.run(port=33507) |
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
Binary file not shown.