From 45350d248d496ccddf54d71471928e0cfcccad07 Mon Sep 17 00:00:00 2001 From: Matt Chan Date: Thu, 25 Jun 2020 12:56:56 -0700 Subject: [PATCH] Blank main page. --- .gitignore | 4 +++- app.py | 22 ++++++++++++++++++---- templates/about.html | 2 +- templates/index.html | 18 ++++++++---------- testing.txt | Bin 40 -> 0 bytes 5 files changed, 30 insertions(+), 16 deletions(-) delete mode 100644 testing.txt diff --git a/.gitignore b/.gitignore index 48fe6f88c..0351ad97a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ htmlcov/ dist/ build/ -*.egg-info/ \ No newline at end of file +*.egg-info/ + +sandbox/ \ No newline at end of file diff --git a/app.py b/app.py index 6d2c93b11..6ad8b47ca 100644 --- a/app.py +++ b/app.py @@ -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) diff --git a/templates/about.html b/templates/about.html index bd69788a7..100cb5028 100644 --- a/templates/about.html +++ b/templates/about.html @@ -7,7 +7,7 @@ - Wilkommen, bienvenue, and welcome to Heroku! + A simple stock price time series visualizer diff --git a/templates/index.html b/templates/index.html index 42834d071..98dddf3d1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,7 +7,7 @@ - Wilkommen, bienvenue, and welcome to Heroku! + A simple stock price time series visualizer @@ -16,20 +16,18 @@
-

Hello, World!

- +

A Simple Stock Price Visualizer

+
+ + + +
- + diff --git a/testing.txt b/testing.txt deleted file mode 100644 index 99d41b0f9bb270aee858cc88de038bb1eae838a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40 qcmezWFN7hLp_rkBA(J7GA)UdBK>^6l0E(3}Bm?P0peQc`7Xtv@>Ik0z