All Articles

How to Run an Http Server Using Python?

We can run a http server using Python.

# For python 3 and above
python3 -m http.server
# For python 2.x
python -m SimpleHTTPServer

This starts the server in the port 8000 (http://localhost:8000). If we want to run the server in a separate port:

python3 -m http.server 3000