Skip to content

Commit b94dccb

Browse files
committed
fixed path stuff for data
1 parent c3706cc commit b94dccb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
from flask import Flask, redirect, render_template, request, url_for, abort
22
import simplejson
3+
import os
34

45
app = Flask(__name__)
56
data = {}
67

78
# import data from relevant JSON
89
def load_data():
910
global data
10-
with open("data/events.json", 'r') as file:
11+
path = os.path.join(os.path.dirname(__file__), "data/events.json")
12+
print path
13+
with open(path, 'r') as file:
1114
data = simplejson.load(file)
1215

1316
@app.route('/')
@@ -30,4 +33,4 @@ def page_not_found(e):
3033
if __name__ == '__main__':
3134
app.run(debug = True, host='0.0.0.0', port=5000)
3235

33-
application = app
36+
application = app

0 commit comments

Comments
 (0)