-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
57 lines (39 loc) · 1.29 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
from flask import Flask, render_template, request, redirect
import fetching # my fetching.py file
app = Flask(__name__)
app.config.update(
DEBUG=True,
)
@app.route('/')
def main():
return render_template('index.html')
# @app.route('/index')
# def index():
# return render_template('index.html')
@app.route('/live_buses')
def live_buses():
nyc = fetching.nyc_current()
plotdf = nyc[['MonitoredVehicleJourney_PublishedLineName',
'MonitoredVehicleJourney_VehicleLocation_Latitude',
'MonitoredVehicleJourney_VehicleLocation_Longitude']]
# add this for plot (may not be using yet)
plotdf = plotdf.assign(intensity=0.2);
#data = list(plotdf.itertuples())
#data = plotdf.values.tolist()
data = plotdf[['MonitoredVehicleJourney_VehicleLocation_Latitude',
'MonitoredVehicleJourney_VehicleLocation_Longitude']].values.tolist()
return render_template('live_buses.html', data=data)
@app.route('/live_example')
def live_example():
return render_template('live_example.html')
@app.route('/page1')
def page1():
return redirect('/')
@app.route('/page2')
def page2():
return redirect('/')
@app.route('/page3')
def page3():
return redirect('/')
if __name__ == '__main__':
app.run(port=33507)