Python Webserver in 1 or 15 lines
Python Webserver in 1 line:
python -c "import SimpleHTTPServer; SimpleHTTPServer.test()"
Python Webserver in 15 lines:
import BaseHTTPServer class WebRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): if self.path == '/foo': self.send_response(200) self.do_something() else: self.send_error(404) def do_something(self): print 'hello world' server = BaseHTTPServer.HTTPServer(('',80), WebRequestHandler) server.serve_forever()