From 624fa47f4f8cc214c1ecd72270db41b65882958b Mon Sep 17 00:00:00 2001 From: pictuga Date: Fri, 28 Aug 2015 19:22:55 +0200 Subject: [PATCH] Allow CLI change of the www/ path --- morss/morss.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/morss/morss.py b/morss/morss.py index 7d2303c..e5630a6 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -621,6 +621,12 @@ def cgi_wrapper(environ, start_response): if url == '': url = 'index.html' + if '--root' in sys.argv[1:]: + path = os.path.join(sys.argv[-1], url) + + else: + path = url + try: body = open(path, 'rb').read() @@ -680,7 +686,7 @@ def main(): # mod_cgi 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 if isInt(sys.argv[1]):