Created
November 17, 2012 06:34
-
-
Save anonymous/4093845 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import SimpleHTTPServer | |
import SocketServer | |
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option("-p", | |
"--port", | |
dest="port", | |
help="port to listen on.", | |
default=8000 | |
) | |
(options, args) = parser.parse_args() | |
if __name__ == '__main__': | |
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler | |
# add the .webapp content type | |
Handler.extensions_map['.webapp'] = 'application/x-web-app-manifest+json' | |
httpd = SocketServer.TCPServer(("", int(options.port)), Handler) | |
print "Serving at port %d" % int(options.port) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment