Python web development that resembles PHP or classic ASP

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Mon May 26 12:17:34 EDT 2008


erik.oosterwaal at gmail.com a écrit :
> Hi All,
> 
(snip history and reasons to switch from old-style ASP).
> 
> So that's when I started looking at other dynamic languages for
> webdevelopment. I looked at Ruby on Rails and at the different web-
> frameworks that are available for Python. The biggest problem there
> for me is that the MVC type frameworks that are currently very popular
> are also not what I'm looking for.
> 
> I like having my directory tree conform to the structure of my
> website, so the "Controller" part of the MVC style of development is
> something I wouldn't want. What I -would- like is a separation of code
> and display logic (so being able to include libraries in a page) and
> being able to intermix code directly into the HTML.

There are a couple points I don't get here. Mostly: how is your 
application logic separated from the presentation logic if you "intermix 
code directly into the HTML" ? Or are you pages including the libs, 
getting the appropriate data out of the DB, and then including another 
file acting as a template ? If so, then how are you're "pages" different 
from MVC frameworks controllers ?

> As Python would be the language I prefer over Ruby, I thought I'd ask
> here to see if anyone in the Python community knows if such a
> development-framework exists in Python.

mod_python + PSP would come to mind - it's probably the closer thing to 
ASP/PHP you'll get in Python - but I don't know if PSP is still 
maintained, and I would by no mean consider such a "framework" for new 
projects (and FWIW, PSP is a bit ugly IMHO).

Mako is a templating engine that let you have quite a lot of Python code 
inside your templates, but you'll still need a separate controller for 
most things.

Writing a wsgi-compatible framework that uses Mako as template engine 
and dispatch to controllers based on the filesystem might not be a very 
difficult task, but even then, I don't see the point of such an 
arrangement - specially when we already have more web frameworks than 
keywords...

> For example, does IronPython
> also use the same web forms approach as asp.net using VB? The
> frameworks I looked at (Django, Pylons) seem to be able to use
> different templating engines, does that mean it's just a question of
> finding the right one?

Django and Pylons both impose a distinct controller.

> Also, for Python there is also the problem of meaningful indentation.
> I'm not even sure if it's possible to use Python directly inside HTML,
> because indentation would be at the very least tricky to maintain.

It's indeed one of the ugly parts of PSP.

> I'm
> kind of hoping here that there are some solutions to these problems
> available in Python.
> 
>  Any help would be greatly appreciated.

I sincerely think you'd be better trying to get up and running with one 
of the existing MVC solutions like Django or Pylons. Now there are quite 
a couple other web frameworks in Python, you know - so perhaps you 
should have a closer look at them ?

My 2 cents...



More information about the Python-list mailing list