aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--doc/example.png (renamed from img/example.png)bin172254 -> 172254 bytes
-rw-r--r--html/css/bootstrap.min.css (renamed from css/bootstrap.min.css)0
-rw-r--r--html/index.html (renamed from index.html)0
-rw-r--r--html/js/bootstrap.bundle.min.js (renamed from js/bootstrap.bundle.min.js)0
-rw-r--r--html/js/jquery.min.js (renamed from js/jquery.min.js)0
-rwxr-xr-xsrc/app.py (renamed from app.py)0
l---------src/html1
-rwxr-xr-xsrc/server.py (renamed from server.py)16
9 files changed, 14 insertions, 5 deletions
diff --git a/README.md b/README.md
index 8f963c9..0eb950a 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ to reboot the server, etc.
![Example page][example]
-[example]: img/example.png "Example page"
+[example]: doc/example.png "Example page"
---
diff --git a/img/example.png b/doc/example.png
index dbc61d0..dbc61d0 100644
--- a/img/example.png
+++ b/doc/example.png
Binary files differ
diff --git a/css/bootstrap.min.css b/html/css/bootstrap.min.css
index 6ee5956..6ee5956 100644
--- a/css/bootstrap.min.css
+++ b/html/css/bootstrap.min.css
diff --git a/index.html b/html/index.html
index 5a4f56f..5a4f56f 100644
--- a/index.html
+++ b/html/index.html
diff --git a/js/bootstrap.bundle.min.js b/html/js/bootstrap.bundle.min.js
index 3af2dc3..3af2dc3 100644
--- a/js/bootstrap.bundle.min.js
+++ b/html/js/bootstrap.bundle.min.js
diff --git a/js/jquery.min.js b/html/js/jquery.min.js
index b061403..b061403 100644
--- a/js/jquery.min.js
+++ b/html/js/jquery.min.js
diff --git a/app.py b/src/app.py
index 5af55af..5af55af 100755
--- a/app.py
+++ b/src/app.py
diff --git a/src/html b/src/html
new file mode 120000
index 0000000..5eb7cf0
--- /dev/null
+++ b/src/html
@@ -0,0 +1 @@
+../html/ \ No newline at end of file
diff --git a/server.py b/src/server.py
index 914765d..75723bd 100755
--- a/server.py
+++ b/src/server.py
@@ -24,6 +24,10 @@ def script_dir():
return os.path.dirname(os.path.realpath(__file__))
+def default_html_dir():
+ return os.path.join(script_dir(), 'html')
+
+
class RequestHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
try:
@@ -55,15 +59,19 @@ def parse_args(args=None):
parser.add_argument('-p', '--port', metavar='PORT',
type=int, default=DEFAULT_PORT,
help='set port number')
+ parser.add_argument('-d', '--dir', metavar='DIR',
+ default=default_html_dir(),
+ help='HTML directory path')
return parser.parse_args(args)
def main(args=None):
- # It's a failsafe; this script is only allowed to serve the directory it
- # resides in.
- os.chdir(script_dir())
-
args = parse_args(args)
+
+ # It's a failsafe; the script is not allowed to serve a random current
+ # working directory.
+ os.chdir(args.dir)
+
httpd = make_server(args.port)
try:
httpd.serve_forever()