-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
45 lines (32 loc) · 1.01 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
from flask import Flask
from flask import render_template, send_file
import os
curr_dir = os.path.dirname(os.path.abspath(__file__)) # current directory
app = Flask(__name__)
# Main route the user takes
@app.route("/")
def index():
return render_template("index.html")
# Route to access death-at-home data
@app.route("/data/alone")
def get_data():
filename = os.path.join(
curr_dir, 'data/alone',
'deaths_alone.gz') # This is compressed and will need to be decompressed in-browser
return send_file(filename)
# Route to access ward data
@app.route("/data/wards")
def get_ward_data():
filename = os.path.join(
curr_dir, 'data/wards',
'wards.geojson')
return send_file(filename)
# Route to access total death data
@app.route("/data/total")
def get_total_death_data():
filename = os.path.join(
curr_dir, 'data/total',
'shibou.json')
return send_file(filename)
if __name__ == "__main__":
app.run(host='127.0.0.0', port=5000, debug=True)