Created
October 2, 2015 17:04
-
-
Save Kyle-Falconer/20d73f1db0ccd16ec816 to your computer and use it in GitHub Desktop.
simple webserver for Python 3, with commented notes for one-liner web service.
This file contains 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
# Python 2: | |
# python -m SimpleHTTPServer | |
# | |
# Python 3: | |
# python -m http.server | |
import http.server | |
def start_server(port=8000, bind="", cgi=False): | |
if cgi==True: | |
http.server.test(HandlerClass=http.server.CGIHTTPRequestHandler, port=port, bind=bind) | |
else: | |
http.server.test(HandlerClass=http.server.SimpleHTTPRequestHandler,port=port,bind=bind) | |
start_server() #If you want cgi, set cgi to True e.g. start_server(cgi=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment