[python] Start a http server

If you want to start a simple httpserver on your windows, you may choose python.simpleHTTPServer module.html

1. install pythonpython

2. create an directory, which will be listed. (in eclipse, you may create a pydev project)linux

image

3. create a .py file, such aswindows

http://docs.python.org/2/library/simplehttpserver.htmlapp

import SimpleHTTPServer
import SocketServer

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()

 

Then go to http://localhost:8000/, you will seeeclipse

image

 

BTW.  On linux,spa

cd <dir-you-want-to-list>3d

python –m simpleHTTPServer 8000 &code

相關文章
相關標籤/搜索