-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (41 loc) · 1.29 KB
/
app.py
File metadata and controls
50 lines (41 loc) · 1.29 KB
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
#!/usr/bin/env python3
from flask import Flask, render_template,url_for,redirect
import os
import json
# from backend import det
import gps
app = Flask(__name__)
people = 0
@app.route('/')
def home():
json_file = open("./static/data.json")
json_str = json_file.read()
data = json.loads(json_str)
return render_template("index.html", data = data)
@app.route('/index.html')
def index():
json_file = open("./static/data.json")
json_str = json_file.read()
data = json.loads(json_str)
return render_template("index.html", data = data)
@app.route('/bus/<bus_no>')
def get_bus_info(bus_no):
json_file = open("./static/data.json")
json_str = json_file.read()
data = json.loads(json_str)
no = data["bus" + str(bus_no)]
imgloc = '/static/bus_' + str(bus_no) + '_loc.png'
return render_template("bus_info.html", no = no, bus_no = bus_no, imgloc = imgloc)
@app.route('/location.html')
def location():
global people
location_stats="Vikramshila"
loc_img = os.path.join("static", "loc.png")
if people == 0:
p = "No processing initiated..."
loc_img = None
else:
p = people
return render_template("location.html", location_stats=location_stats, number=p, loc_img=loc_img)
if __name__ == "__main__":
app.run(debug=True)