×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: petecocoon
Added: Nov 16, 2011 8:19 AM
Views: 443
With Python is easy run a simple HTTP server in current directory. Just paste the following code in a script file and enjoy.
  1. #!/usr/bin/env python
  2. import SimpleHTTPServer
  3. import SocketServer
  4.  
  5. PORT = 8000
  6.  
  7. Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
  8.  
  9. httpd = SocketServer.TCPServer(("", PORT), Handler)
  10.  
  11. print "Server running on port ", PORT
  12. httpd.serve_forever()