Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python web development that resembles PHP or classic ASP

Reply
Thread Tools

Python web development that resembles PHP or classic ASP

 
 
erik.oosterwaal@gmail.com
Guest
Posts: n/a
 
      05-25-2008
Hi All,

I have been developing websites in classic asp using VB script for a
long while now. Due to the fact that I also took a detour to
developing ColdFusion, and the fact the companies I work(ed) for never
had time or money for courses, I am now in the awkward position that I
am -still- developing classic ASP.

In it, I have become quite resourceful, I wrote a framework using WSC
(windows scripting components) to separate logic from presentation,
and my display pages use almost no logic, except for the loops and
variables I need to build my pages. I have a three-tier setup and all
business logic is in separate WSC files. The framework even uses an
ORM for access to the tables of my database. This works like a charm.
It makes classic ASP code maintainable, it makes working in classic
ASP very pleasant actually and it makes our customers very happy.

The problem is that classic asp is now a dead language, I need to
modernize and fast! Although the arguments some people make against it
are not valid for me (spaghetti code, unmaintainable, slow), I still
see that there is little to no support for it anymore.

The most logical way to "update" my knowledge to something more
modern, would be to dive into ASP.NET. I considered that for a long
time, but there are some problems with this:

1. I love the control I have over my html using inline, template-based
vbscript. ASP.NET's web forms really sound like a very bad idea, also
the approach Microsoft takes in trying to make a stateless web-app
seem like a statefull application is IMHO a burden. I think webapps
are inherently different than desktop apps, and should be programmed
as such.

2. Who says Microsoft isn't going to pull the plug on VB.NET in a
while or make a drastic change like they did from asp to asp.net
again, some time in the future?

3. I like the rapid development I can do in a dynamic, loosely typed
language like vbscript. The performance-bottleneck of a site is mostly
in the database-access and the http-calls and I think writing all of
the declarations and types for a strong-typed language is overkill for
a webapp.

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.

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. 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?

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. I'm
kind of hoping here that there are some solutions to these problems
available in Python.

Any help would be greatly appreciated.

Kind regards,

Erik
 
Reply With Quote
 
 
 
 
Max M
Guest
Posts: n/a
 
      05-26-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) skrev:
> Hi All,


> 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.


Hi Erik,

I am an experienced Python developer working mostly in Plone. Before
that I came from asp like you.


If you want something that is most like what you are used to, you should
check out Django. I have not worked in it, but it get high praises from
developers I trust.

http://www.djangoproject.com/


If you want a more "modern" approach you should check out Grok. It has
been built on all the experiences made with Zope 2, CMF and Plone. It is
based on Zope 3.

http://grok.zope.org/

It is the one I would choose if starting from fresh today.


--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

 
Reply With Quote
 
 
 
 
Sebastian 'lunar' Wiesner
Guest
Posts: n/a
 
      05-26-2008
[ Max M <(E-Mail Removed)> ]

> (E-Mail Removed) skrev:
>> Hi All,

>
>> 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.

>
> Hi Erik,
>
> I am an experienced Python developer working mostly in Plone. Before
> that I came from asp like you.
>
>
> If you want something that is most like what you are used to, you should
> check out Django. I have not worked in it, but it get high praises from
> developers I trust.
>
> http://www.djangoproject.com/


Django is one of these "MFC type frameworks" the OP was excatly _not_
looking for

> If you want a more "modern" approach you should check out Grok. It has
> been built on all the experiences made with Zope 2, CMF and Plone. It is
> based on Zope 3.
>
> http://grok.zope.org/
>
> It is the one I would choose if starting from fresh today.


Grok too is very different from classic asp programming, it even abstracts
much more from HTTP than Django does.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
 
Reply With Quote
 
Sebastian 'lunar' Wiesner
Guest
Posts: n/a
 
      05-26-2008
[ (E-Mail Removed) <(E-Mail Removed)> ]

> 1. I love the control I have over my html using inline, template-based
> vbscript. ASP.NET's web forms really sound like a very bad idea, also
> the approach Microsoft takes in trying to make a stateless web-app
> seem like a statefull application is IMHO a burden. I think webapps
> are inherently different than desktop apps, and should be programmed
> as such.
> [...]
> 3. I like the rapid development I can do in a dynamic, loosely typed
> language like vbscript. The performance-bottleneck of a site is mostly
> in the database-access and the http-calls and I think writing all of
> the declarations and types for a strong-typed language is overkill for
> a webapp.
>
> 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.


Summarising, you are searching for a framework, which allows you to embed
much code in templates, follows the directory structure of a classic
conventional website and has ORM features, but does not resemble desktop
programming or use the MVC pattern.

In this case I feel like have to disappoint you, I don't know any such thing
for python. You will have to put this together from different components.

I guess, using a simple WSGI wrapper as Werkzeug or Paste, and combining it
with a powerful ORM like SQLAlchemy and a templating engine, which allows
you to embed full python code in the templates (e.g. Mako), will best suite
your needs, as it gives you the freedom to design the application following
your ideas.

Modern frameworks like Django or Grok require a somewhat great adaption,
since they strongly restrict the programmer's freedom. I doubt, that you
would get Django or Grok working like your asp framework.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      05-26-2008
Sebastian 'lunar' Wiesner a écrit :
(snip)
> Django is one of these "MFC type frameworks"


Actually it's "MVC", not "MFC" !-)

 
Reply With Quote
 
Bruno Desthuilliers
Guest
Posts: n/a
 
      05-26-2008
(E-Mail Removed) 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...
 
Reply With Quote
 
Ivan Illarionov
Guest
Posts: n/a
 
      05-26-2008
On Mon, 26 May 2008 17:49:01 +0200, Sebastian 'lunar' Wiesner wrote:

[...]
> Modern frameworks like Django or Grok require a somewhat great adaption,
> since they strongly restrict the programmer's freedom. I doubt, that
> you would get Django or Grok working like your asp framework.


Actually, mordern frameworks (at least Djagno) does not "restrict the
programmer's freedom", they only encourage clean design.

It's perfectly possible to write Django app with only one view and url
pattern that redirects everything to different template engine like
Cheetah or Mako and all the logic could be put inside those templates.

But, IMHO, writing PHP-style Python webapp is silly.

Ivan
 
Reply With Quote
 
Sebastian 'lunar' Wiesner
Guest
Posts: n/a
 
      05-26-2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ Ivan Illarionov <(E-Mail Removed)> ]

> On Mon, 26 May 2008 17:49:01 +0200, Sebastian 'lunar' Wiesner wrote:
>
> [...]
>> Modern frameworks like Django or Grok require a somewhat great adaption,
>> since they strongly restrict the programmer's freedom. I doubt, that
>> you would get Django or Grok working like your asp framework.

>
> Actually, mordern frameworks (at least Djagno) does not "restrict the
> programmer's freedom", they only encourage clean design.


Can we agree on the fact, that Django _encourages clean design_ by
_restricting the programmers freedom to some degree_? This comprise would
avoid an endless war about framework philosophy (and isn't so far from
the truth, btw)

> It's perfectly possible to write Django app with only one view and url
> pattern that redirects everything to different template engine like
> Cheetah or Mako and all the logic could be put inside those templates.


Absolutely, but that's not what Django is about. If you don't follow
Django's conventions and don't make use of Djangos facilities like its ORM
or its admin interface, Django just doesn't make sense anymore.

An application such as you outlined would depend on a big, heavy framework
to do a task, that could easily be done with plain WSGI or a WSGI wrapper
like Werkzeug.

> But, IMHO, writing PHP-style Python webapp is silly.


I completely agree here, but that's not, what the OP asked for

- --
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkg69CIACgkQn3IEGILecb5vyACeLCLF2WfvKS Ue466HeUqZYXj8
AC8An1+sUvbyWiIu9mBixQ9ME0j1Ts+j
=6lQT
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Ivan Illarionov
Guest
Posts: n/a
 
      05-26-2008
Sebastian 'lunar' Wiesner wrote:

>>> Modern frameworks like Django or Grok require a somewhat great
>>> adaption, since they strongly restrict the programmer's freedom. I
>>> doubt, that you would get Django or Grok working like your asp
>>> framework.

>>
>> Actually, modern frameworks (at least Djagno) does not "restrict the
>> programmer's freedom", they only encourage clean design.

>
> Can we agree on the fact, that Django _encourages clean design_ by
> _restricting the programmers freedom to some degree_? This comprise
> would avoid an endless war about framework philosophy (and isn't so
> far from the truth, btw)


Yes, it makes very little sense to not follow conventions in Django. I
have no problem with some people call it "some degree of restriction"

If the OP wants PHP-style programming he will get better results with PHP
because PHP was designed this way. Any Pythonic solution will be an
overkill.

Ivan
 
Reply With Quote
 
Sebastian 'lunar' Wiesner
Guest
Posts: n/a
 
      05-26-2008
[ Ivan Illarionov <(E-Mail Removed)> ]

> If the OP wants PHP-style programming he will get better results with PHP
> because PHP was designed this way. Any Pythonic solution will be an
> overkill.


Better shoot yourself in the foot with a PHP-like Python-thing, than
committing suicide by shooting yourself into the head with PHP ...

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
PHP Web Development | Hire PHP Web Developers infocus Software 0 07-19-2010 10:23 AM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
Microsoft's Latest XP Vulnerability Resembles Adobe PDF 'Flaw' Au79 Computer Support 1 10-12-2007 03:29 AM
javap -c output resembles FORTH(?) Tarkin Java 2 06-10-2006 04:19 PM



Advertisments