r/tinycode • • Jun 30 '11

Python simple http webserver. One liner.

http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
4 Upvotes

12 comments sorted by

5

u/samineru Jun 30 '11

This is a helpful shortcut, but I imagine what's going on in the background really isn't that...tiny.

2

u/[deleted] Jun 30 '11

Sure. But what isn't built upon layers and layers of libraries?

At least this one is built into Python by default. No required modules.

3

u/samineru Jun 30 '11

Sure. But what isn't built upon layers and layers of libraries?

Tiny code.

1

u/nexe mod Jun 30 '11

Thats an interesting question. Should things like this be considered as tiny or as "tiny on the front, big in the back"? I'm not so sure. Definitely not an easy question.

1

u/samineru Jun 30 '11

Well I think that tiny on the front, big in the back would be more r/tinyux. I think tiny on the front, tiny on the back is best, but r/tinycode seems to mean tiny on the back. That was an extremely repetitive sentence...

2

u/nexe mod Jul 01 '11

Tiny on the back isn't always necessary. /r/tinycode doesn't mean tiny on the back per se. It is more meant in the terms of yagni/kiss/dry/elegant/reusable/few lines of code/easy understandable.

1

u/[deleted] Jun 30 '11

I recently used this to pull files off a dying linux box. Even with the filesystem corrupted and not allowing some commands to complete, I was able to start the webserver and backup key files.

Not the fastest web server, but it works.

2

u/JerMenKoO Jul 01 '11

If you use Python 3, then:

python -m http.server

1

u/Liquid_Fire Jun 30 '11

It's not multithreaded unfortunately, so don't expect to be transferring more than one file at a time using this.

1

u/Tarlitz Jun 30 '11

Thanks for sharing, this is really cool. Just tested it with a friend, and he had no problem accessing it. Seems like a very nice way to quickly send some files to others.