Python Quickie: Start A Static Webserver Everywhere

This quickie shows you how to start a static webserver everywhere with python. It’s easier than you would think. Read how to!

If you’re like me, you’ll be trying lots of differnet things during coding. Maybe you’re messing around with angular.js and are tired of setting up an apache for it. You just want to create a folder /home/username/code/angularjs/ for it and test there. You can start a static webserver everywhere. And here’s how:

With python 2 you’ll have to run this command:

With python 3 you can use a “shorter” one:

With this command the server will run on port 80. And keep in mind, that the server will be accsesible for everyone in the network (depending on the network settings of course).

You can read more about this topic here. There is even a way to start a php server on the fly.