473,706 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python web development that resembles PHP or classic ASP

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
Jun 27 '08 #1
15 2393
er************* @gmail.com 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

Jun 27 '08 #2
[ Max M <ma**@mxm.dk]
er************* @gmail.com 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)
Jun 27 '08 #3
[ er************* @gmail.com <er************ *@gmail.com]
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)
Jun 27 '08 #4
Sebastian 'lunar' Wiesner a écrit :
(snip)
Django is one of these "MFC type frameworks"
Actually it's "MVC", not "MFC" !-)

Jun 27 '08 #5
er************* @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...
Jun 27 '08 #6
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
Jun 27 '08 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ Ivan Illarionov <iv************ *@gmail.com]
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)

iEYEARECAAYFAkg 69CIACgkQn3IEGI Lecb5vyACeLCLF2 WfvKSUe466HeUqZ YXj8
AC8An1+sUvbyWiI u9mBixQ9ME0j1Ts +j
=6lQT
-----END PGP SIGNATURE-----
Jun 27 '08 #8
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
Jun 27 '08 #9
[ Ivan Illarionov <iv************ *@gmail.com]
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)
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2842
by: Don Bruder | last post by:
A week or two ago, I asked here about porting Python to C. Got some good answers (Note 1) but now I've got another question. Actually, more a request for clarification of a topic that both the Python tutorial and docs leave a touch murky to my understanding. Dictionaries/"dict" types... Am I understanding/interpreting correctly when I go with the idea that a "dict" variable can be looked at as (effectively) two parallel arrays?...
36
6390
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but something I'll need in this case is some experience-based set of rules about how to use python in this context. For example... is defining readonly attributes in classes worth the hassle ? Does duck-typing scale well in complex
9
2032
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more pythonic approach. One thing I've been seeing suggested a lot lately is that running jobs in separate processes, to make it easy to use the latest multiprocessor machines. Makes a lot of sense to me, those processors are going to be more and...
19
2314
by: Chris Brat | last post by:
I've seen a few posts, columns and articles which state that one of the advantages of Python is that code can be developed x times faster than languages such as <<Insert popular language name here>>. Does anyone have any comments on that statement from personal experience? How is this comparison measured? Thanks
122
5492
by: C.L. | last post by:
I was looking for a function or method that would return the index to the first matching element in a list. Coming from a C++ STL background, I thought it might be called "find". My first stop was the Sequence Types page of the Library Reference (http://docs.python.org/lib/typesseq.html); it wasn't there. A search of the Library Reference's index seemed to confirm that the function did not exist. A little later I realized it might be called...
0
8783
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9056
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5939
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2503
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2096
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.