-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebserver.py
53 lines (29 loc) · 1.08 KB
/
webserver.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
import http.server
import socketserver
import sys
from flask_cors import CORS
# Corrected path with a comma
sys.path.insert(1, 'C:\\Users\\200183\\Documents\\Projektarbeit\\Workspace_test\\comm.py')
PORT = 8080
DIRECTORY = "./web"
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
handler = Handler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
sys.stderr.write("Serving at port {}\n".format(PORT))
#CORS(httpd)
httpd.serve_forever()
#import http.server
#import socketserver
#import sys
#sys.path.insert(1 'C:\Users\200183\Documents\Projektarbeit\Workspace_test\comm.py')
#PORT = 8080
#DIRECTORY = "./web"
#class Handler(http.server.SimpleHTTPRequestHandler):
# def __init__(self, *args, **kwargs):
# super().__init__(*args, directory=DIRECTORY, **kwargs)
#
#with socketserver.TCPServer(("", PORT), Handler) as httpd:
# print("serving at port", PORT)
# httpd.serve_forever()