8 lines
411 B
Python
8 lines
411 B
Python
import http.server,os,json,functools
|
|
from pathlib import Path
|
|
r=Path(__file__).resolve().parents[1]
|
|
handler=functools.partial(http.server.SimpleHTTPRequestHandler,directory=str(r/'web/out'))
|
|
s=http.server.ThreadingHTTPServer(('127.0.0.1',0),handler)
|
|
(r/'.local-service.json').write_text(json.dumps(dict(pid=os.getpid(),port=s.server_port,url='http://127.0.0.1:'+str(s.server_port)),indent=2))
|
|
s.serve_forever()
|