forked from JKattack/cardconjurer
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathlauncher.py
More file actions
40 lines (31 loc) · 706 Bytes
/
launcher.py
File metadata and controls
40 lines (31 loc) · 706 Bytes
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
"""
IMPORTS
"""
from http.server import SimpleHTTPRequestHandler, HTTPServer
import webbrowser
import os
"""
SETTINGS
"""
NAME = "localhost"
PORT = 8080
DIRECTORY = os.getcwd()
"""
REQUEST HANDLER
"""
class Handler(SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
"""
START APP
"""
if __name__ == "__main__":
webServer = HTTPServer((NAME, PORT), Handler)
print("Server started http://%s:%s" % (NAME, PORT))
try:
webbrowser.open('http://localhost:8080', new=2)
webServer.serve_forever()
except KeyboardInterrupt:
pass
webServer.server_close()
print("Server stopped.")