Prepare V2 corpus, editorial journal and reproducible publication boundary
This commit is contained in:
1 parent
7b3f49788d
commit
69607c52fd
498 files changed
+97671
-468
No files matched your search
@@ -1,7 +1,14 @@
|
||||
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'))
|
||||
static=Path(os.environ.get('PROGCODE_STATIC_ROOT',str(r/'web/out'))).resolve()
|
||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||
def send_error(self,code,message=None,explain=None):
|
||||
if code==404 and (static/'404.html').exists():
|
||||
b=(static/'404.html').read_bytes();self.send_response(404);self.send_header('Content-Type','text/html; charset=utf-8');self.send_header('Content-Length',str(len(b)));self.end_headers()
|
||||
if self.command!='HEAD':self.wfile.write(b)
|
||||
else:super().send_error(code,message,explain)
|
||||
handler=functools.partial(Handler,directory=str(static))
|
||||
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))
|
||||
(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),staticRoot=str(static)),indent=2))
|
||||
s.serve_forever()
|
||||
Reference in new issue
Block a user