1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-23 03:26:15 +03:00

web: serve script for lab

This commit is contained in:
Rasmus Andersson 2018-09-05 18:45:10 -07:00
parent cc6505cae9
commit 3a38dd4737
2 changed files with 30 additions and 0 deletions

1
docs/lab/inter-ui.css Symbolic link
View File

@ -0,0 +1 @@
../inter-ui.css

29
docs/lab/serve.py Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
from __future__ import print_function, absolute_import
import os, sys
import signal
import SimpleHTTPServer
import socket
import SocketServer
def sighandler(signum, frame):
sys.stdout.write('\n')
sys.stdout.flush()
sys.exit(1)
class TCPServer(SocketServer.TCPServer):
def server_bind(self):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(self.server_address)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# make ^C instantly exit program
signal.signal(signal.SIGINT, sighandler)
httpd = TCPServer(
("127.0.0.1", 3002),
SimpleHTTPServer.SimpleHTTPRequestHandler)
print("serving at http://localhost:3002/")
httpd.serve_forever()