-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
56 lines (42 loc) · 1.29 KB
/
index.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
import authorization_server
import resource_server
import client
import threading
import os
import webbrowser
from config import HOST, CLIENT_PORT
# import _thread
class AuthServer(threading.Thread):
def run(self):
authorization_server.run()
class ResServer(threading.Thread):
def run(self):
resource_server.run()
class ClientServer(threading.Thread):
def run(self):
client.run()
def create_servers():
# try:
# _thread.start_new_thread(authorization_server.run, ())
# _thread.start_new_thread(resource_server.run, ())
# except BaseException as be:
# print(be)
# while 1:
# pass
auth_thread = AuthServer()
res_thread = ResServer()
client_thread = ClientServer()
auth_thread.start()
res_thread.start()
client_thread.start()
return (client_thread, auth_thread, res_thread)
if __name__ == '__main__':
servers = create_servers()
# visit localhost:8080
chromepath = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'
url = "http://%s:%d" % (HOST, CLIENT_PORT)
if os.path.isfile(chromepath):
webbrowser.get("{!s} %s".format(chromepath)).open(url)
else:
print('Please goto %s with your favorite browser.' % url)
[server.join() for server in servers]