HTML Templates (Sitemesh/Tiles concept) in Python
onurb at xiludom.gro
Mon Oct 23 19:57:58 CEST 2006
> I am a newbie to python and web development. I am part of a fairly
> simple project and we are trying to identify an efficient way to design
> and python for now.
Python with ? CGI ? FastCGI ? mod_python ? Other ?
> Our pages bear a very standard look. Here is what it looks like.
> l1 through l5 are links that basically target the content page and fill
> in. Each page via that link has a python reference to go gather
> appropriate data for the content page. We are using frames to do the
> banner.html, menu.html (the links page) and the content page.
You shouldn't - unless this is an internal web-based application, not a
public site. Since your dynamically generating the pages, there's no
gain using frames - but there are huge drawbacks, for the programmers as
well as for the visitors.
> For the content page, how can we decorate it on top with the back/front
> buttons and logout buttons and botton with a copyright in every page.
> It seems error prone as well as bad design to scatter this logic in
> each content page. Is there a template logic like Sitemesh or Tiles
> concept that can decorate a desired page just before show time?
There are lot of web templating engines in Python, and most of them
provide some way to either "extend" an existing template (to fill-in
page-specific stuffs) or to do server-side-includes-like inclusion of
common parts. Google for Genshi, Jinja, SimpleTAL, Mighty, Cheetah...
> Any other tips to help life easier are appreciated.
Have you considered using one of the existing python web development
libraries/frameworks? Like Pylons, Turbogears, Django, Spyce, Karigell,
etc, etc, etc, etc...
My 2 cents...
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list