from http.server import * import os import subprocess class MyHandler(SimpleHTTPRequestHandler): def send_head(self): path = self.translate_path(self.path) path = os.path.relpath(path) subprocess.run(["make", path]) return super().send_head() HTTPServer(("localhost", 8080), MyHandler).serve_forever()