-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
36 lines (27 loc) · 845 Bytes
/
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
import csv
import os
from flask import Flask, render_template, url_for, request
app = Flask(__name__)
hoursList = [] # Might rename variable
currentFolder = os.path.dirname(os.path.abspath(__file__))
csvFile = os.path.join(currentFolder, "static/data/hours.csv")
with open(csvFile) as hoursCSV:
next(hoursCSV)
csvReader = csv.reader(hoursCSV, delimiter=',')
for row in csvReader:
venue = {
"name": row[0],
"sunday": row[1],
"monday": row[2],
"tuesday": row[3],
"wednesday": row[4],
"thursday": row[5],
"friday": row[6],
"saturday": row[7]
}
hoursList.append(venue)
@app.route('/')
def index():
return render_template('index.html', venues=hoursList)
if __name__ == "__main__":
app.run(debug=True)