A simple python server

I guess it’s not a simple python server. It is really simple and easy to deploy python server. Just imagine you want to share a folder on your pc with someone on your network. What you will do? Obviously you will start the sharing service but what if you have python installed and want an easier solution? Here you go. You can just type in:

$ python -m SimpleHTTPServer

This should be typed in the terminal or command prompt if you are a windows guy. Just open command prompt. Navigate to the directory which you want to share and then run this command. Unlike the normal sharing services this server will also show you the IP addresses of the PCs which are accessing that folder. Pretty slick right?

Do share your views about this post below in the comments.



If you liked what you read then I am sure you will enjoy a newsletter of the content I create. I send it out every other month. It contains new stuff that I make, links I find interesting on the web, and occasional discount coupons for my book. Join the 5000+ other people who receive my newsletter:

I send out the newsletter once every other month. No spam, I promise + you can unsubscribe at anytime

✍️ Comments


>>> normally indicates the Python prompt ($ is often used a shell prompt). To use this webserver in Python, you’ll need to create a SocketServer first and then plug in the SimpleHTTPRequestHandler in there.

In reply to Philipp

Philipp it’s not like that. Only this command (-m SimpleHTTPServer ) does the trick. That’s why it is called a Simple server. I have tested it and there’s no need for further setup.


No, you don’t need to run a new Python process to embed the simple HTTP server in your Python application (say, because you want to share your application’s source code or so). SocketServer.TCPServer((“”, 8080), SimpleHTTPServer.SimpleHTTPRequestHandler).serve_forever() (in a new thread) is sufficient

In reply to Philipp

Let me clear your confusion. This tutorial is about folder sharing and if i do -m SimpleHTTPServer then i will get the logs as well. I know we can get logs from your method as well but i think we should prefer a one liner than a two or four liner :)

ansh bansal

Actually Windows powershell is much easier and powerful than command prompt

In reply to ansh bansal

I know it but some don’t so that’s why i wrote command prompt :)

Say something

Send me an email when someone comments on this post.

Thank you!

Your comment has been submitted and will be published once it has been approved. 😊