Allow CLI change of the www/ path
parent
31fc939d52
commit
624fa47f4f
|
@ -621,6 +621,12 @@ def cgi_wrapper(environ, start_response):
|
||||||
if url == '':
|
if url == '':
|
||||||
url = 'index.html'
|
url = 'index.html'
|
||||||
|
|
||||||
|
if '--root' in sys.argv[1:]:
|
||||||
|
path = os.path.join(sys.argv[-1], url)
|
||||||
|
|
||||||
|
else:
|
||||||
|
path = url
|
||||||
|
|
||||||
try:
|
try:
|
||||||
body = open(path, 'rb').read()
|
body = open(path, 'rb').read()
|
||||||
|
|
||||||
|
@ -680,7 +686,7 @@ def main():
|
||||||
# mod_cgi
|
# mod_cgi
|
||||||
wsgiref.handlers.CGIHandler().run(cgi_wrapper)
|
wsgiref.handlers.CGIHandler().run(cgi_wrapper)
|
||||||
|
|
||||||
elif len(sys.argv) <= 1 or isInt(sys.argv[1]):
|
elif len(sys.argv) <= 1 or isInt(sys.argv[1]) or '--root' in sys.argv[1:]:
|
||||||
# start internal (basic) http server
|
# start internal (basic) http server
|
||||||
|
|
||||||
if isInt(sys.argv[1]):
|
if isInt(sys.argv[1]):
|
||||||
|
|
Loading…
Reference in New Issue