[REF] extras: improve code

This commit is contained in:
Géry Debongnie
2019-05-03 11:14:34 +02:00
parent e060130655
commit 10ab97e3c6
4 changed files with 34 additions and 20 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Misc Benchmarks</title>
<title>OWL Extras</title>
</head>
<body>
<h1>🦉 OWL Extra Stuff 🦉</h1>
+24 -10
View File
@@ -3,18 +3,32 @@ import thread
import webbrowser
import time
import BaseHTTPServer, SimpleHTTPServer
import BaseHTTPServer
import SimpleHTTPServer
HOST = '127.0.0.1'
PORT = 8000
class OWLHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/extras/owl.js':
self.path = '/dist/owl.js'
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
def start_server():
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 3600), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd = BaseHTTPServer.HTTPServer((HOST, PORT), OWLHandler)
httpd.serve_forever()
thread.start_new_thread(start_server,())
url = 'http://127.0.0.1:3600/extras'
webbrowser.open_new(url)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)
if __name__ == "__main__":
thread.start_new_thread(start_server, ())
url = 'http://{0}:{1}/extras'.format(HOST, PORT)
webbrowser.open_new(url)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)