-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapplication.py
39 lines (27 loc) · 906 Bytes
/
application.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
import os
from flask import Flask, request, render_template, redirect
# Setting app to be
app = Flask("__name__")
# Set the API KEY of Javascript Maps API
if not os.environ.get("API_KEY"):
raise RuntimeError("API_KEY not set")
# Homepage of the application
@app.route("/")
def index():
return render_template("index.html")
# Speed test route handling
@app.route('/testing', methods=["GET", "POST"])
def testing():
if request.method == "POST":
timing = request.form.get('timing')
return render_template("testing.html", timing=timing)
else:
return render_template("testing.html", timing=60)
# Flash typing page
@app.route("/flashtyping")
def flashtyping():
return render_template("flashtyping.html")
# Renders the Contact us page
@app.route("/contactus")
def contactus():
return render_template("contactus.html", API_KEY=os.environ.get('API_KEY'))