a
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""Simple HTTP server for PaperRecognizer frontend."""
|
||||
import http.server
|
||||
import socketserver
|
||||
import os
|
||||
|
||||
PORT = 8912
|
||||
DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=DIR, **kwargs)
|
||||
|
||||
def log_message(self, format, *args):
|
||||
print(f"[{self.log_date_time_string()}] {args[0]} {args[1]} {args[2]}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(DIR)
|
||||
print(f"Serving at http://0.0.0.0:{PORT}/")
|
||||
print(f"Open http://localhost:{PORT}/ in your browser")
|
||||
with socketserver.TCPServer(("0.0.0.0", PORT), Handler) as httpd:
|
||||
httpd.serve_forever()
|
||||
Reference in New Issue
Block a user