python web server serving files in a directory

server.py, this python code simply serves all the files in the directory where this python file is located.

import SimpleHTTPServer
import SocketServer
PORT = 8088
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()

Run it

python server.py

Open the url localhost:8088 in a browser and you will see a list of files from the folder where you put the server.py

Or use curl in a new terminal window

curl localhost:8088

Search within Codexpedia

Custom Search

Search the entire web

Custom Search