File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,11 @@ def load_config():
8484 "api" : {"base_url" : "http://localhost:8000/api" }
8585 }
8686
87+ BASE_DIR = os .path .dirname (os .path .abspath (__file__ ))
8788class IRISVisualizerHandler (http .server .SimpleHTTPRequestHandler ):
8889 def __init__ (self , * args , ** kwargs ):
89- super ().__init__ (* args , directory = os .getcwd (), ** kwargs )
90+ server_root = os .path .dirname (os .path .abspath (__file__ ))
91+ super ().__init__ (* args , directory = server_root , ** kwargs )
9092
9193 def do_GET (self ):
9294 """Handle GET requests"""
@@ -123,7 +125,7 @@ def do_GET(self):
123125
124126 # Read and send file content
125127 try :
126- file_path = os .path .join (os . getcwd () , path .lstrip ('/' ))
128+ file_path = os .path .join (BASE_DIR , path .lstrip ('/' ))
127129 if os .path .exists (file_path ):
128130 with open (file_path , 'rb' ) as f :
129131 self .wfile .write (f .read ())
You can’t perform that action at this time.
0 commit comments