Sometimes we just need a quick HTTP server up and running, and we don’t want to bother setting up Apache, Nginx or anything like that. We just want to check a static website layout… or share some pictures in our local network. Quick and simple.
We will get a message informing that it’s serving on port 8000 (which is the default port):
And that’s it! It’s serving our directory on
For example, let’s say I want to share my
~/Pictures directory with my colleagues via local network on port
Assuming my IP address on the local network is
10.1.0.1, my colleagues will be able to check out my pictures on
The HTTP server changes a little bit in Python 3. A note from the docs:
SimpleHTTPServermodule has been merged into
http.serverin Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.
But it’s still one line command:
Run it with
--help argument to see detailed options: