Update Python simple server script to allow subdomains
This commit is contained in:
parent
8957b4ed8b
commit
1d9b7d855d
@ -3,9 +3,23 @@ import urlparse, os
|
|||||||
|
|
||||||
PORT = 3000
|
PORT = 3000
|
||||||
|
|
||||||
|
## Note: If you set this parameter, you can try to serve files
|
||||||
|
# at a subdirectory. You should use
|
||||||
|
# -u http://localhost:3000/subdirectory
|
||||||
|
# when building the application, which will set this as your
|
||||||
|
# ROOT_URL.
|
||||||
|
#URL_PATH="/subdirectory"
|
||||||
|
URL_PATH=""
|
||||||
|
|
||||||
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
|
||||||
|
# Strip the subdirectory from the PATH
|
||||||
|
# e.g. localhost:3000/subdirectory/packages/ohif_polyfill/svg4everybody.min.js
|
||||||
|
# is interpreted by this script as localhost:3000/packages/ohif_polyfill/svg4everybody.min.js
|
||||||
|
# so the file is found properly.
|
||||||
|
self.path = self.path.replace(URL_PATH, "")
|
||||||
|
|
||||||
# Parse query data to find out what was requested
|
# Parse query data to find out what was requested
|
||||||
parsedParams = urlparse.urlparse(self.path)
|
parsedParams = urlparse.urlparse(self.path)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user