Skip to content

Instantly share code, notes, and snippets.

@z-------------
Created December 2, 2014 00:51
Show Gist options
  • Save z-------------/8d05102d561476bc96d4 to your computer and use it in GitHub Desktop.
Save z-------------/8d05102d561476bc96d4 to your computer and use it in GitHub Desktop.
import sys
from http.server import CGIHTTPRequestHandler, HTTPServer
port = 8000
if len(sys.argv) > 1:
port = int(sys.argv[1])
handler = CGIHTTPRequestHandler
handler.cgi_directories = ["/py"]
server = HTTPServer(("", port), handler)
print("Server running on port " + str(port))
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment