A Simple python script that acts as a web server, and handles requests
1 2 3 4 5 6 7 8 9 10 11 | import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
|
Tags: httpserver, webserver
This is straight from the documentation...
You don't even need to create any code.
python -m SimpleHTTPServer <PORT_NUMBER>