/
bottle_server.py
executable file
·73 lines (44 loc) · 1.5 KB
/
bottle_server.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
import os, time
from bottle import route, run, static_file, template, view
@route("/quiz/<name>")
@view("index")
def hello(name):
return dict(name=name)
@route('/quiz/css/<filename>')
def img_static(filename):
return static_file(filename, root='./static/css')
@route('/quiz/font/<filename>')
def img_static(filename):
return static_file(filename, root='./static/font')
@route('/quiz/img/<filename>')
def img_static(filename):
return static_file(filename, root='./static/img')
@route('/quiz/js/<filename>')
def js_static(filename):
return static_file(filename, root='./static/js')
@route('/quiz/json/<filename>')
def vid_static(filename):
return static_file(filename, root='./static/json')
@route('/quiz/prism/<filename>')
def vid_static(filename):
return static_file(filename, root='./static/prism')
@route("/quiz/QuizCreator")
@view("QuizCreator")
def hello2():
return dict()
@route('/quiz/note/<name>/<idquiz>/<subTitle>/<points>/<total>')
def img_static(name, idquiz, subTitle, points, total):
print(name + " - " + points + "/" + total)
fichier = open("log.csv", "a")
fichier.write("\n" + idquiz + ", " + time.strftime('%H:%M:%S, %d/%m/%y') + ", " + subTitle + ", " + points + ", " + total + ", " + name)
fichier.close()
if __name__ == "__main__":
port = int(os.environ.get("PORT", 8030))
run(
host = '0.0.0.0',
port = port,
reloader = True,
server = 'paste',
debug = True
)