Go Straight to Content

What I'll Be Ranting About

Good development practices bring us quality code, confident systems, and missed launch windows. When do you refactor and when do you factor in the passing time? As engineers we need to design what is possible and capable. As programmers we need to turn imagination into reality without a physical product. As developers we need to bridge the gab between that engineered vision and the end product.

I also blog more personally over at my tumblr page.

I am available for small contracts, consultations, tutoring, and other development services. My "skills" as a technical writer are also available. If you've got anything you'd like to talk to me about or for me to see, drop me a line.

Friday, February 23, 2007

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()"

5 comments:

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.

Roger Erens said...

With Billy Joex' new pyftpdlib something alike is possible for an FTP-server:
python -m pyftpdlib.FTPServer

see
http://billiejoex.altervista.org/pyftpdlib.html

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

Blog Archive