-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.py
52 lines (40 loc) · 1.25 KB
/
application.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
import os
from flask import Flask, jsonify, render_template, request, session
from flask_jsglue import JSGlue
from flask_socketio import SocketIO
app = Flask(__name__)
app.config['SECRET_KEY'] = 'Hp3n>3N2qZ;TmUQYLj3@n28wCotC3,9dMbWnh6>8zvN,'
JSGlue(app)
socketio = SocketIO(app)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/login/")
def login():
return render_template("login.html")
@app.route("/login/verify", methods=["POST"])
def verify_login():
# TODO: add verification
return "done"
@app.route("/teachers/")
def teachers():
return render_template("teachers.html")
@app.route("/teachers/config")
def teacher_config():
return render_template("teacher/config.html")
@app.route("/students")
def student():
return render_template("student/index.html")
@app.route("/students/no/")
def student_no():
# TODO: localize to a specific class
socketio.emit('no', {'data': 'none'})
return jsonify({'success': True})
@app.route("/students/yes/")
def student_yes():
# TODO: localize to a specific class
socketio.emit('yes', {'data': 'none'})
return jsonify({'success': True})
if __name__ == "__main__":
port = int(os.environ.get('PORT', 5000))
socketio.run(app, host='0.0.0.0', port=port)