-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
72 lines (61 loc) · 2.53 KB
/
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
from shotglass import Shotglass
app = Shotglass()
@app.route("/",'GET')
def index(client_socket):
with open('templates/home.html', 'r') as file:
html_string = file.read()
response = app.create_response(200, "text/html", html_string)
app.send_response(client_socket, response)
@app.route("/Development",'GET')
def index(client_socket):
with open('templates/Development.html', 'r') as file:
html_string = file.read()
response = app.create_response(200, "text/html", html_string)
app.send_response(client_socket, response)
@app.route("/vs",'GET')
def index(client_socket):
with open('templates/vs.html', 'r') as file:
html_string = file.read()
response = app.create_response(200, "text/html", html_string)
app.send_response(client_socket, response)
@app.route("/documentation",'GET')
def index(client_socket):
with open('templates/Doc.html', 'r') as file:
html_string = file.read()
response = app.create_response(200, "text/html", html_string)
app.send_response(client_socket, response)
@app.route("/static/num.png",'GET')
def serve_static(client_socket):
file_path = "static/num.png"
with open(file_path, 'rb') as file:
file_data = file.read()
response = app.create_response(200, "image/png", file_data,{"Content-Length": len(file_data)})
app.send_response(client_socket, response)
@app.route("/static/time.png",'GET')
def serve_static(client_socket):
file_path = "static/time.png"
with open(file_path, 'rb') as file:
file_data = file.read()
response = app.create_response(200, "image/png", file_data,{"Content-Length": len(file_data)})
app.send_response(client_socket, response)
@app.route("/static/cpu.png",'GET')
def serve_static(client_socket):
file_path = "static/cpu.png"
with open(file_path, 'rb') as file:
file_data = file.read()
response = app.create_response(200, "image/png", file_data,{"Content-Length": len(file_data)})
app.send_response(client_socket, response)
@app.route("/static/style.css",'GET')
def serve_static(client_socket):
file_path = "static/style.css"
with open(file_path, 'r') as file:
file_data = file.read()
response = app.create_response(200, "text/css", file_data)
app.send_response(client_socket, response)
@app.errorhandler(404)
def page_not_found(client_socket):
with open('templates/404.html', 'r') as file:
html_string = file.read()
response = app.create_response(200, "text/html", html_string)
app.send_response(client_socket, response)
app.run()