-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·39 lines (30 loc) · 1.02 KB
/
main.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
from flask import Flask, render_template
import os, csv
app = Flask(__name__)
@app.route('/')
def google_map():
files = {'study': 'study.csv', 'science': 'science.csv', 'work': 'work.csv'}
data = {}
for filename, filepath in files.iteritems():
file = csv.reader(open(os.path.dirname(os.path.realpath(__file__)) + '/files/' + filepath, 'r'))
headers = file.next()
entries = []
for line in file:
entries.append(dict((unicode(key, 'utf-8').strip(), unicode(value, 'utf-8').strip()) for key, value in dict(zip(headers, line)).iteritems() if key))
data[filename] = entries
return render_template('map.html', data=data)
@app.route('/demand')
def demand():
return render_template('demand.html')
@app.route('/ads')
def ads():
return render_template('ads.html')
@app.route('/apps')
def apps():
return render_template('apps.html')
@app.route('/extra')
def extra():
return render_template('extra.html')
if __name__ == '__main__':
app.debug = True
app.run()