Simple HTTP Server in Python


If you want to quickly share files on a local network without the issue of setting up file sharing or finding those pesky pendrives. Here’s a one liner that will help you out.

python -m SimpleHTTPServer

Python comes with a simple built-in HTTP server. With the help of this little HTTP server you can turn any directory in your system into your web server directory. The only thing you need to have installed is Python.

And if you’re on the Linux platform you’re in luck. It comes with Python pre-installed.

So how do you go about it.

1. Find out your IP address

ifconfig

2. Navigate to the directory you want to share.

cd /home/somedir

3. Run the command.

python -m SimpleHTTPServer <port_number> #Defaults to 8000

And voila..

Step 1
Step 3: In this case on the port number 8000
Anyone accessing 192.169.1.11:8000 will be able to access the folder you’re in.