diff --git a/SourceCode-NAS-Olivito_Gianluca_CDS205_HS24.py b/SourceCode-NAS-Olivito_Gianluca_CDS205_HS24.py new file mode 100644 index 0000000..449a0b6 --- /dev/null +++ b/SourceCode-NAS-Olivito_Gianluca_CDS205_HS24.py @@ -0,0 +1,19 @@ +# Import libraries +import http.server +import socketserver + +# Define port and path tho external drive directory +PORT = 8000 +DIRECTORY = "/mnt/mydisk" + +class MyHandler(http.server.SimpleHTTPRequestHandler): + def translatePath(self, path): + # Modifizieren des Standardverhaltens von SimpleHTTPRequestHandler + path = super().translate_path(path) + return path if path.startswith(DIRECTORY) else DIRECTORY + path + +handler = MyHandler +httpd = socketserver.TCPServer(("", PORT), handler) + +print(f"Serving on port {PORT}") +httpd.serve_forever() \ No newline at end of file