Initial commit
parent
c3c2d6db3e
commit
f9e6f5e9e1
|
@ -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()
|
Loading…
Reference in New Issue