Python : Convert your Computer Directory into live Server
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
If you see this message then your server is Live.
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 π