Skip to content

Instantly share code, notes, and snippets.

@mhingston
Last active May 11, 2017 14:54
Show Gist options
  • Save mhingston/2537aed303e08c6a3ff1b210317425a4 to your computer and use it in GitHub Desktop.
Save mhingston/2537aed303e08c6a3ff1b210317425a4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import http.server
import socketserver
socketserver.ThreadingTCPServer.allow_reuse_address = True
HOST = "127.0.0.1"
PORT = 8000
handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer((HOST, PORT), handler)
try:
print("Serving HTTP on %s port %s ..." % (HOST, PORT))
httpd.serve_forever()
except KeyboardInterrupt:
raise SystemExit
@mhingston
Copy link
Author

Or just python -m http.server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment