Crazy little thing called : SimpleHTTPServer
Python brings you a one line web-server !
Simplest webserver ever !
I was logged onto a tiny VPS I use sometimes and thinking it would be useful to have a web-server to help move a few files off it. The thought of installing a ‘real’ web-server seemed a bit much for what would five minutes of use so I started thinking about Python (of course !).
It turns out that you can fire up a (completely unsecured and rather wild-west) web server like this :
python -m SimpleHTTPServer
When you type that command the current directory becomes the root of a web-resource, accessible via port 8000 – rather than the default port 80 we usually use for HTTP, and any files, and sub-directories, in the current directory can be accessed like this
and, for stuff in sub-directories, like this
Don’t say you weren’t warned
There are of course all sort of circumstances where doing this would be a REALLY BAD IDEA ™ but all the same it’s nice to know it’s there if you need it !