simple webserver for Python 3, with commented notes for one-liner web service.
# 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)