A one-line command to use a local server!

Hima Bindu
1 min readJul 25, 2020

All thanks to Python!

If you are looking for a local server for your HTML files, Python gives a helping hand!

Steps:

Open your Terminal/Command line

Go to the respective Directory where the file exists that you want to open that with a local server.

Use these commands for your following versions:
Python 2: python -m SimpleHTTPServer 8000
Python 3: python3 -m http.server 8000

Now, Type http://localhost:8000/ in your browser and select the respective HTML file.

Use ctrl+c to exit!

Tada! Now you are running a local server.

NOTE: I used port 8000 above but you can choose any port you want(like 8080), and remember that any port number below 1024 may give you permission denied errors if not executing as root.

For more info refer to Python’s Documentation!

Adios! ✨

--

--