forked from auxfuse/OvertheRainbow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
67 lines (46 loc) · 1.56 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
import json
from flask import Flask, render_template, request, redirect, url_for, flash, session
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/home")
def home():
return render_template('home.html', page_title="Over the Rainbow")
@app.route("/support")
def support():
data = []
with open("data/advocates.json", "r", encoding="utf8") as json_data:
data = json.load(json_data)
return render_template("support.html", page_title="Supporting LGBTQ+ Community", advocates=data)
@app.route("/flags")
def flags():
data = []
with open("data/flags.json", "r", encoding="utf8") as json_data:
data = json.load(json_data)
return render_template("flags.html", page_title="Meet the flags", flags=data)
@app.route("/accessibility")
def accessibility():
return render_template('accessibility.html')
@app.route("/privacy")
def privacy():
return render_template('privacy-policy.html')
@app.route("/e500")
def e500():
return render_template('500.html')
# Error Handling
@app.errorhandler(404)
def response_404(exception):
"""When 404 is captured display custom 404.html page"""
return render_template('404.html', exception=exception)
@app.errorhandler(500)
def response_500(exception):
"""When 500 is captured display custom 500.html page"""
return render_template('500.html', exception=exception)
if __name__ == "__main__":
app.run(
host = os.environ.get('IP', '127.0.0.1'),
port = os.environ.get('PORT', '5000'),
debug=True
)