Python : Convert your Computer Directory into live Server

Play this article

Hello guys πŸ‘‹ This is really an amazing feature of Python programming language. With a simple line of code you can make a live server. Once you have run this command anyone can access it thru provided address. So let's see how this magic works ?

Pre Requisites

- A working Desktop
- Python Software installed in your computer
- Internet Connection

Note - This starts a file server that can be accessed on the same network

Live server

Now it's time to do the magic. Go to the directory which you want to make live. i.e. D:\projects\myPortfolio (myPortfolio is a folder)

open command prompt in your current directory or the directory which you want to make live. Run this command : python -m http.server

image.png

If you see this message then your server is Live.

image.png

How to access it

This starts a file server that can be accessed on the same network. To access your files on mobile, simply connect to the same network (wifi or use the phone’s hotspot on a laptop). Now in your phone browser open –


Check your IP by running – ifconfig. Check your local IP (should start with 192.168….) Suppose your IP is – 192.168.43.155 and you use the default port. Then, you should open – 192.168.43.155:8000 on mobile/ browser. You’ll see current directory πŸ™‚

Did you find this article valuable?

Support A K Singh Rajpoot by becoming a sponsor. Any amount is appreciated!

Β