Recommendation for small, fast, Python based web server

python at bdurham.com python at bdurham.com
Wed Dec 9 19:00:56 EST 2009


Tim,

> I've used WebStack[1] for this in the past. It allows for stand-alone serving as well as plugging nicely into various "real" servers (apache+mod_python, etc) with a small tweak in how it's configured.

Thanks for that recommendation.

> I'm not sure what caused the slowness you've experienced (... with running local versions of Python web servers)

Thanks to a past post by "Christoph Zwerschke" <cito at online.de>, I was
able to identify the problem.

Windows (XP, Vista, Windows 7) tries to do a IPV6 connection which times
out after a second followed by an IPV4 connection which is almost
instantaneous. Apparently this is a known problem that is a Windows
issue [1] - not a Python problem.

Two workarounds:

1. Use 127.0.0.1 as your URL vs. localhost 

-OR-

2. Edit your Windows hosts file (c:\windows\system32\drivers\etc\hosts)
and create a virtual domain name, eg. put the following on a line by
itself:

127.0.0.1  mydomain.someext

And then use mydomain.someext vs. localhost

Note: Editing your hosts file requires admin rights under Vista and
Windows 7.

Regards,
Malcolm

[1]
http://schotime.net/blog/index.php/2008/05/27/slow-tcpclient-connection-sockets/



More information about the Python-list mailing list