mirror of
https://github.com/rsms/inter.git
synced 2024-11-23 11:43:47 +03:00
web: serve script for lab
This commit is contained in:
parent
cc6505cae9
commit
3a38dd4737
1
docs/lab/inter-ui.css
Symbolic link
1
docs/lab/inter-ui.css
Symbolic link
@ -0,0 +1 @@
|
||||
../inter-ui.css
|
29
docs/lab/serve.py
Executable file
29
docs/lab/serve.py
Executable 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()
|
Loading…
Reference in New Issue
Block a user