#!/usr/bin/env python3
import http.server, socketserver, os, sys

PORT = 8765
os.chdir(os.path.dirname(os.path.abspath(__file__)))

class H(http.server.SimpleHTTPRequestHandler):
    def log_message(self, fmt, *args):
        sys.stderr.write("[server] " + (fmt % args) + "\n")

socketserver.TCPServer.allow_reuse_address = True
with socketserver.TCPServer(("", PORT), H) as httpd:
    sys.stderr.write(f"[server] serving on http://localhost:{PORT}\n")
    httpd.serve_forever()
