From: Tim Chase on
python(a)bdurham.com wrote:
> I'm looking for a small, simple, fast, Python based web server
> for a simple, client side application we're building.

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.

> I've looked at the web servers that come bundled with the Python
> standard library[1] and they are too slow. I suspect this is
> because they don't maintain a session between the client and
> server, thus every GET/POST request repeats the session setup and
> break down process. Or they might be based on a polling model?

I'm not sure what caused the slowness you've experienced -- using
Python in a CGI environment requires starting the Python
interpreter each time. However if the interpreter starts just
once, I've not had notable performance issues for low-volume
sites (using the BaseHTTP builtin). For higher-volume sites, you
might reach for Twisted which WebStack supports as well. I
believe both WebStack and Twisted are redistribtable as needed.

-tkc

[1] http://www.boddie.org.uk/python/WebStack.html




From: Daniel Fetchinson on
> I'm looking for a small, simple, fast, Python based web server
> for a simple, client side application we're building. We don't
> want to distrubute and support a "real" web server like Apache or
> Tomcat or depend on the presence of local web server such as IIS.
> The application in question will service AJAX requests from a
> browser.
>
> We're not looking for a web framework like Django, Plone, etc.
>
> I've looked at the web servers that come bundled with the Python
> standard library[1] and they are too slow. I suspect this is
> because they don't maintain a session between the client and
> server, thus every GET/POST request repeats the session setup and
> break down process. Or they might be based on a polling model?
>
> Here are the other Python based web server implementations I'm
> aware of:
> - cherrypy
> - web.py
> - twisted
>
> Any recommendations appreciated (Python 2.6 preferred but open to
> Python 3.1 options).

I'm using cherrypy for this purpose, actually together with turbogears 1.

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
From: python on
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(a)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/
From: python on
Daniel,

> I'm using cherrypy for this purpose, actually together with turbogears 1.

My research has constantly pointed back to cherrypy as a tool of choice
for building local web servers. My initial impression was that cherrypy
was too big and complicated for my simple task. However, I'm going to
re-examine this assumption and take another look at cherrypy.

Thanks for your help!

Regards,
Malcolm
From: birdsong on
On Dec 9, 4:05 pm, pyt...(a)bdurham.com wrote:
> Daniel,
>
> > I'm using cherrypy for this purpose, actually together with turbogears 1.
>
> My research has constantly pointed back to cherrypy as a tool of choice
> for building local web servers. My initial impression was that cherrypy
> was too big and complicated for my simple task. However, I'm going to
> re-examine this assumption and take another look at cherrypy.
>
> Thanks for your help!
>
> Regards,
> Malcolm

tornado all the way, it is teh radness: http://www.tornadoweb.org/

epoll based python server. fun to hack on. def check it out.