Python web development, really

Ian Bicking ianb at colorstudy.com
Fri Jan 24 15:19:44 EST 2003


On Fri, 2003-01-24 at 04:30, Afanasiy wrote:
> On 23 Jan 2003 15:57:33 -0600, Ian Bicking <ianb at colorstudy.com> wrote:
> 
> >On Mon, 2003-01-20 at 11:16, Afanasiy wrote:
> >> * Run on the same hardware I use currently
> >
> >Yes, so long as you can run long-running processes.  Most commercial
> >shared-hosting situations don't allow this.  This applies to all Python
> >frameworks except when accessed strictly through CGI, which will give
> >you atrocious performance.
> 
> Webware is it's own daemon which would run behind Apache?
> So..., stability depends on another daemon, one with much
> less testing than Apache? Does it use lots of 3rd party
> Python modules/code to provide this daemon?

Yes, it is essentially a daemon -- a program running in the background
that handles requests.  This is true of almost all Python web
frameworks.

A daemon is just a process running in the background.  There's not much
special code involved.

> >> * Allow all errors to be caught and handled so users never see them
> >>   (I currently send them to an email address)
> >>   (Users are notified an error occurred and a developer contacted)
> >
> >Yep.
> 
> With a global handler or pasting in your
> try except handling block every page?

It's handled for you.

> >> * Allow similarly powerful regex capabilities
> >>   (I currently use PHP's pcre module)
> >
> >Again, using Python's re module (IMHO much easier to use than in PHP).
> 
> Can you elaborate? I use PHP's heredoc syntax for my complex regex.

Well, I find the quoting and handling of regexes in PHP to be annoying,
but I'm not an advanced PHP programmer and there might be conveniences
I'm missing.  I think Python's re module works pretty well.

> >I believe there's ways to do this with Apache while using Webware.  But
> >you can (in effect) do this in Webware fairly easily.  Each page of a
> >Webware application is a separate class.  Generally there will be a
> >superclass that you write that is specific to your application.  In it
> >you can put a header and footer, and those can be as dynamic as you
> >choose. 
> 
> Where does this class live? Do I have to edit .htaccess every time
> I create a new page, I saw that in the mod_python documentation.
> I am aware of different connectors, but mod_python looks likely.

For Webware you wouldn't want to use mod_python.  There's mod_webkit
which is a small module that just is meant to connect to the AppServer
(it's analogous to SCGI, and vaguely like a simplified FastCGI).  You
can also use a CGI interface (which shouldn't be confused as meaning
Webware runs as a CGI -- just the adapter can run as such).

.htaccess files aren't really used for anything in Webware -- though you
can chain Webware with other Apache modules like mod_gzip.  I haven't
experimented with this a great deal, though.

Your servlets are all plain classes in Webware.  The classes can inherit
from other classes, so you might have a Login class (servlet) which
inherits from SitePage (your class that defines the look and other
convenience methods), which inherits from Page (a class that comes with
Webware).  

-- 
Ian Bicking           Colorstudy Web Development
ianb at colorstudy.com   http://www.colorstudy.com
PGP: gpg --keyserver pgp.mit.edu --recv-keys 0x9B9E28B7
4869 N Talman Ave, Chicago, IL 60625 / (773) 275-7241






More information about the Python-list mailing list