-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (25 loc) · 810 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
from flask import Flask, jsonify, render_template, make_response
from flask_cors import CORS, cross_origin
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@app.route('/api/get')
@cross_origin()
def getData():
file = open('./static/data/data.txt', 'r')
re = file.read()
temp = re.split('\n')[-2]
d = dict(map(lambda x: x.split(':'), temp.split(',')))
return jsonify(d)
@app.route('/')
@app.route('/dashboard')
@cross_origin()
def index():
resp = make_response(render_template('dashboard.html', active_page="home"))
resp.headers['X-Content-Type-Options'] = 'nosniff'
return resp
@app.route('/circuit')
def components():
return render_template('circuit.html', active_page="circuit")
if __name__ == "__main__":
app.run(debug=True)