SimpleHTTPServer is very handy tool, Python module. It allows you to run temporary web server on your machine very quickly and without extra setup if you need to share some files with your users, colleagues on the network. You do not need to have installed Cyqwin, however you need to install Python.
The SimpleHTTPServer module is used in this manner:
import SimpleHTTPServer import SocketServer PORT = 8000 Handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever()
You can start the SimpleHTTPServer by using this command on Mac/Linux and you will be sharing content of the directory where you executed this command:
python -m SimpleHTTPServer 8000
However in Windows you will receive this error message:
python.exe: No module named SimpleHTTPServer
Here is easy fix, in Windows has been this module renamed in Python and you need to use this command line instead:
python -m http.server 8000
All is good !
Hi,
I used it but I’m not able to post a file to the http server.
How can I do that?
Thanks.
You have to in command line navigate to the folder which you want to host on the server and start the http.server from that directory. Once done you will see listing all files,folders in web browser.