[Tutor] Database driven web sites with python

Charlie Clark charlie@begeistert.org
Sun Jan 19 06:31:40 2003


On 2003-01-19 at 00:19:27 [+0100], Magnus Lycka wrote:
> *I* think mixing HTML and code is typically bad, but having looked
I think it's important to menation why it's bad: it takes a while to focus 
your mind on the important bit and separate code from HTML.

> Another thing I like with CherryPy is the templating language CHTL which 
> puts all the dynamic data in attributes. This means that the guy who 
> writes HTML can use sample data in his files, and see what the page will 
> look like in a web browser without running the application. He can simply 
> open his HTML file in Mozilla or whatever. When it's running in the 
> application, his sample data will be replaced by live data. The 
> attributes can also survive most HTML editors, so an HTML file can go 
> back and forth between HTML writer and Python coder without things 
> getting messed up. (Unless the HTML writer is stupid enough to erase 
> those funny attributes like py-eval that he doesn't understand, but he 
> won't see them in WYSIWYG mode...)

This is the same as Zope Page Templates. However, you are able to use 
proper Python functions in ZPT:
<br tal:content="python: 2*3">
Statements have to be put in PythonScripts and this works very well once 
you get used to it.
Using xHTML namespaces to do this seems to be standard practice now as well 
for "tag libraries" in JSP and .NET
Works great with the Zope External Editor

> A more serious problem is that as far as I understand it has to be run 
> like a long running process, and I don't always have the ability to set 
> up such processes on web sites I work with.
pcgi? It's probably possible to run it inside the webserver via redirection 
just like it is with Zope.
 
> >Marcus' objection 
> Who's Marcus? ;)
Magnus, verlaat me!

> Right... As in "Except that it doesn't work, how do you like this 
> software?" ;)
No, as in none of the products has been declared stable. "Adaptable 
storage" looks very promising and seeing as it's been developed by Shane 
Hathaway of Zope Corp., looks like it may well make it. One of the aims of 
Zope 3 is to have better support for this kind of thing.
 
> >I really like being able (re)organise parts of the site as it develops: 
> >Zope is quite nice when you change things and I've become a big fan of 
> >PageTemplates. But it has all taken time. Expect to need about 6 weeks 
> >before feeling comfortable with Zope
> 
> I always gave up faster than that every time I tried. :(
I can understand that. But once I'd done the built-in tutorial I was in a 
better position to start. I have the advantage of being able to compare 
with it with several content management systems and know that they're no 
better. I've really learned a lot about Zope over the last couple of months 
haveing started on a very simple project which has continually grown.
 
> Other Zope critisism can be found at
> http://www.amk.ca/python/writing/why-not-zope.html
Yes, Andrew makes some good points.
 
> That's what I'm waiting for. Well, I'll probably wait for 3.1...
I wish I was good enuff at programming to make a contribution. Maybe by 
4.x...
 
> >You might also want to look at the eGenix Web Application server. 
> >http://www.egenix.com/
> >It has rock-solid database support and a nice approach to embedding 
> >Python code in HTML and will have excellent web service support.
> 
> You mean if he wants to buy a service from Guru Lemburg? Or is that 
> available some other way?

oh, I've got the documentation and I think it should be commercially 
available at some point. I thought it was only fair to mention a commercial 
product. Separation of code and HTML in eGenix is quite good.

Charlie