Skip to main content

Standard Gems: SimpleHTTPServer.test()

Have you ever needed to share some files real quick with real low setup? You can start up a web server from the current directory on port 8000 with a single line of python.

python -c "from SimpleHTTPServer import test; test()"


Tim Golden said…
Even simpler (in recent versions):

python -m SimpleHTTPServer
Colin said…
Nice! I used to keep a copy of 'a-ftp.exe' around for simple file sharing, but it seems MSFT has tagged it as spyware and started deleting it :(

Very handy, thanks.
Anonymous said…
With Billy Joex' new pyftpdlib something alike is possible for an FTP-server:
python -m pyftpdlib.FTPServer

Bill Mill said…
Here's a quick hack to serve a non-8000 port, 19028 in this case:

python -c "from SimpleHTTPServer import test; import sys; sys.argv = [None, 19028]; test()"
Anonymous said…
Hey Bill, more concise:
python -c "from SimpleHTTPServer import t; t()" 19028

Popular posts from this blog

CARDIAC: The Cardboard Computer

I am just so excited about this. CARDIAC. The Cardboard Computer. How cool is that? This piece of history is amazing and better than that: it is extremely accessible. This fantastic design was built in 1969 by David Hagelbarger at Bell Labs to explain what computers were to those who would otherwise have no exposure to them. Miraculously, the CARDIAC (CARDboard Interactive Aid to Computation) was able to actually function as a slow and rudimentary computer.  One of the most fascinating aspects of this gem is that at the time of its publication the scope it was able to demonstrate was actually useful in explaining what a computer was. Could you imagine trying to explain computers today with anything close to the CARDIAC? It had 100 memory locations and only ten instructions. The memory held signed 3-digit numbers (-999 through 999) and instructions could be encoded such that the first digit was the instruction and the second two digits were the address of memory to operate on

Interrupting Coders Isn’t So Bad

Here’s a hot take: disrupting coders isn’t all that bad. Some disruptions are certainly bad but they usually aren’t. The coder community has overblown the impact. A disruption can be a good thing. How harmful disruption might be a symptom of other problems. There are different kinds of disruptions. They are caused by other coders on your team, managers and other non-coders, or meetings throughout the day. The easiest example to debunk is a question from a fellow developer. Imagine someone walks over to your desk or they ping you on Slack, because they have “one quick question.” Do you get annoyed at the interruption when you were in the middle of something important? You help out your teammate quickly and get back to work, trying to pick up where you left off. That’s a kind of interruption we complain about frequently, but I’m not convinced this is all that bad. You are being disrupted but your team, of which you are only one member of the whole unit, is working smoothly. You u

It's a Boy!

This is a little late, because I've just been so busy, but my first child, my son, Caelan Mathew Spealman, was born on May 13, 2006 at 11:45, just fifteen minutes before Mother's Day. It was the most amazing expirience in my life, to go from a couple to a family as my son was brought into this world, and honestly, this is just so cool! I can't wait to teach him to program. I might be showing how much geek I am by saying this, but my one-and-a-half week old son already has his own computer.