Website using Python--what's best architecture? CGI?

Ian Bicking ianb at colorstudy.com
Fri Mar 14 21:15:50 EST 2003


On Fri, 2003-03-14 at 14:55, Chris wrote:
> I would like to create a commercial website using Python.  It seems
> that straight CGI would be the easiest option, but I'm wondering what
> its top capacity would be, and also what other options are commonly
> available for a website that I will be hosting through a commercial
> host.  Here are some specific questions:
> 
> 1. Is there any good ballpark figure on an upper limit of throughput
> for Python cgi pages that need to connect to mysql?  I realize this
> depends on many things, but I guess I am wondering if this is even a
> sane option for a "moderately busy" website where almost all pages
> will be dynamic and will need to create a db connection?  I'm thinking
> online store if that helps at all.

Mmm... I wouldn't use CGI, though it could be possible.  The MySQL
connection, for instance, is pretty fast to set up (not necessarily true
for other databases), so it's okay that you're reconnecting for every
page view.  Depending on the CPU power of the host and the traffic it
might be fine.  But there are ceilings on performance that you can bump
up against pretty quickly.

One technique for optimizing CGI is to make as few requests use CGI as
possible.  For instance, Freeform does this to achieve fairly high
performance with CGI (http://savannah.nongnu.org/projects/freeform/) --
in this case, it's for publishing news.  When an article is posted, the
static HTML files are generated for that file.  You can use
server-side-includes to make this even easier (so you can update the
sidebar without updating every page that might include a sidebar).  If
your site is read-heavy, then this can work.  This could aid in an
online store, but it would introduce some limitations.

> 2. What are other options available via commercial hosts?  Is
> something like "mod_python" or "Webware" commonly available on
> commercial hosts (I know nothing much about either one, btw)?  Or some
> of the other Python web application frameworks I see mentioned?  Seems
> like a lot of these would require that you own the hosting machine and
> have total control over it, which wouldn't be an option here.

Check the Python website.  The Python wiki also lists some frameworks:
  http://www.python.org/cgi-bin/moinmoin/WebProgramming

If you don't use CGI, then yes, you have to find a host that
specifically supports your chosen framework.

Personally I use and am a developer for Webware, but there's several
good programs.  I don't think Zope is what you're looking for.

-- 
Ian Bicking  ianb at colorstudy.com  http://colorstudy.com
4869 N. Talman Ave., Chicago, IL 60625  /  773-275-7241
"There is no flag large enough to cover the shame of 
 killing innocent people" -- Howard Zinn






More information about the Python-list mailing list