Skip to content

Commit c938813

Browse files
committed
Example of a WSGI application serving the current directory, accept
optional directory and port number on the command line.
1 parent 74fd34c commit c938813

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Tools/scripts/serve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def app(environ, respond):
2525
return [b'not found']
2626

2727
if __name__ == '__main__':
28-
path = sys.argv[1]
28+
path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
2929
port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
3030
httpd = simple_server.make_server('', port, app)
3131
print("Serving {} on port {}, control-C to stop".format(path, port))

0 commit comments

Comments
 (0)