lxq.link
postscategoriestoolsabout

Python's SimpleHTTPServer Module

ON THIS PAGE

Python’s SimpleHTTPServer is a simple http server with Python.

python -m SimpleHTTPServer

Now the http server will start in port 8000.

If the directory has a file named index.html, that file will be served as the initial file. If there is no index.html, then the files in the directory will be listed.

If you wish to change the port that's used start the program via:

python -m SimpleHTTPServer <port>

The SimpleHTTPServer module has been merged into http.server in Python 3.0. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.

The command in python3 is:

python3 -m http.server <port>
2019-08-02