Python web development that resembles PHP or classic ASP

Discussion in 'Python' started by erik.oosterwaal@gmail.com, May 25, 2008.

  1. Guest

    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
     
    , May 25, 2008
    #1
    1. Advertising

  2. Max M Guest

    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
     
    Max M, May 26, 2008
    #2
    1. Advertising

  3. [ Max M <> ]

    > 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)
     
    Sebastian 'lunar' Wiesner, May 26, 2008
    #3
  4. [ <> ]

    > 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)
     
    Sebastian 'lunar' Wiesner, May 26, 2008
    #4
  5. Sebastian 'lunar' Wiesner a écrit :
    (snip)
    > Django is one of these "MFC type frameworks"


    Actually it's "MVC", not "MFC" !-)
     
    Bruno Desthuilliers, May 26, 2008
    #5
  6. 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...
     
    Bruno Desthuilliers, May 26, 2008
    #6
  7. 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
     
    Ivan Illarionov, May 26, 2008
    #7
  8. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    [ Ivan Illarionov <> ]

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

    iEYEARECAAYFAkg69CIACgkQn3IEGILecb5vyACeLCLF2WfvKSUe466HeUqZYXj8
    AC8An1+sUvbyWiIu9mBixQ9ME0j1Ts+j
    =6lQT
    -----END PGP SIGNATURE-----
     
    Sebastian 'lunar' Wiesner, May 26, 2008
    #8
  9. 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
     
    Ivan Illarionov, May 26, 2008
    #9
  10. [ Ivan Illarionov <> ]

    > 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)
     
    Sebastian 'lunar' Wiesner, May 26, 2008
    #10
  11. On Mon, 26 May 2008 21:26:55 +0200, Sebastian 'lunar' Wiesner wrote:

    > [ Ivan Illarionov <> ]
    >
    >> 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 ...


    :) I can't imagine anything uglier than Python with its significant
    whitespace wrapped inside HTML. I guess it could be more damaging than
    PHP which was written exactly for this purpose.
     
    Ivan Illarionov, May 26, 2008
    #11
  12. Guest

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


    I have the WSC files as "libraries" I can open in a standard ASP page,
    So for example, to get a recordset in one of my ASP pages, I would use
    something like

    Dim objUsers, Recordset_of_users
    Set objUsers= GetObject("script:" & Server.MapPath("/~components/
    users.wsc"))
    objUsers.open()
    Set Recordset_of_users =
    objUsers.getUsersByGroup(request.queryString("group_id"))
    objUsers.close()
    Set objUsers= Nothing

    I put code like this at the top of my ASP pages, and inside the HTML
    code I can use "Recordset_of_users" and loop through it (for example).
    All code in the asp pages is getting and setting information, or
    looping through it. All real (business) logic is inside the WSC files.

    The only real difference is that I don't use the "C" of MVC. I dislike
    a controller that calls and routes functionality based on the URL. The
    M (model) functionality is covered by the WSC files. The V (view) are
    the asp pages themselves. The controller part is handled by the asp
    pages aswell, just using regular links, GETs and POSTs in forms.

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


    :) Maybe I need to pick up a new style of programming as well, on top
    of just a new language...

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


    LOL, point taken.

    So to summarize: it should be possible to get exactly what I want, but
    it's not advisable, because the frameworks aren't designed to work
    like this. That makes sense.
    I want to thank you guys for all the advice, I have a lot of
    frameworks and template-engines to look into now, I'll have a look at
    all that you mentioned to see which one suits me best. Judging from
    the quick and thorough support from the Python community, I think I
    will stick with a proven framework and/or style, so I can ask a
    question once in a while.
    There is probably less sense in trying to pick up a new language while
    at the same time trying to stick to the methods I used in an old
    language. But hey, I thought, maybe a thing like this already exists
    exactly like I want it... Ah well.

    Thanks again all, take care!

    Erik
     
    , May 26, 2008
    #12
  13. Ivan Illarionov a écrit :
    > On Mon, 26 May 2008 21:26:55 +0200, Sebastian 'lunar' Wiesner wrote:
    >
    >> [ Ivan Illarionov <> ]
    >>
    >>> 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 ...

    >
    > :) I can't imagine anything uglier than Python with its significant
    > whitespace wrapped inside HTML. I guess it could be more damaging than
    > PHP which was written exactly for this purpose.


    Mako template's syntax looks not so ugly to me:

    <%inherit file="base.html"/>
    <% rows = [[v for v in range(0,10)] for row in range(0,10)] %>
    <table>
    % for row in rows:
    ${makerow(row)}
    % endfor
    </table>

    <%def name="makerow(row)">
    <tr>
    % for name in row:
    <td>${name}</td>\
    % endfor
    </tr>
    </%def>
     
    Bruno Desthuilliers, May 27, 2008
    #13
  14. On Tue, 27 May 2008 09:10:40 +0200, Bruno Desthuilliers wrote:

    > Ivan Illarionov a écrit :
    >> On Mon, 26 May 2008 21:26:55 +0200, Sebastian 'lunar' Wiesner wrote:
    >>
    >>> [ Ivan Illarionov <> ]
    >>>
    >>>> 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 ...

    >>
    >> :) I can't imagine anything uglier than Python with its significant
    >> whitespace wrapped inside HTML. I guess it could be more damaging than
    >> PHP which was written exactly for this purpose.

    >
    > Mako template's syntax looks not so ugly to me:
    >
    > <%inherit file="base.html"/>
    > <% rows = [[v for v in range(0,10)] for row in range(0,10)] %> <table>
    > % for row in rows:
    > ${makerow(row)}
    > % endfor
    > </table>
    >
    > <%def name="makerow(row)">
    > <tr>
    > % for name in row:
    > <td>${name}</td>\
    > % endfor
    > </tr>
    > </%def>


    Mako templates are alright. I like them more than Django templates.
     
    Ivan Illarionov, May 27, 2008
    #14
  15. a écrit :
    >> 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 ?

    >
    > I have the WSC files as "libraries" I can open in a standard ASP page,
    > So for example, to get a recordset in one of my ASP pages, I would use
    > something like
    >
    > Dim objUsers, Recordset_of_users
    > Set objUsers= GetObject("script:" & Server.MapPath("/~components/
    > users.wsc"))
    > objUsers.open()
    > Set Recordset_of_users =
    > objUsers.getUsersByGroup(request.queryString("group_id"))
    > objUsers.close()
    > Set objUsers= Nothing
    >
    > I put code like this at the top of my ASP pages, and inside the HTML
    > code I can use "Recordset_of_users" and loop through it (for example).
    > All code in the asp pages is getting and setting information, or
    > looping through it. All real (business) logic is inside the WSC files.


    > The only real difference is that I don't use the "C" of MVC.


    Yes you do. It's exactly what your code snippet above is : a controller.
    Or at least the same part of the controller that we identify as such
    in web MVC frameworks (the web server and request to handlers mechanism
    being the other, less visible but still present part). Having the
    controller's code mixed up with the view is pretty common in GUI
    toolkits, and not so uncommon in "server pages" frameworks.


    > I dislike
    > a controller that calls and routes functionality based on the URL.


    Oh yes ? And how is it so different from having the web server routing
    to requests to .asp files calls based on a url-filesystem mapping ?-)
    Except, of course, that getting rid of the filesystem mapping decouples
    the app's urls scheme from the source code inner organisation ?

    > The
    > M (model) functionality is covered by the WSC files. The V (view) are
    > the asp pages themselves. The controller part is handled by the asp
    > pages aswell, just using regular links, GETs and POSTs in forms.
    >
    >> But, IMHO, writing PHP-style Python webapp is silly.

    >
    > :) Maybe I need to pick up a new style of programming as well, on top
    > of just a new language...


    Given your above explanations, I don't think going the "full" MVC route
    would require that much changes to your current habits. That is mostly:
    splitting the controller part from the view part, and learn to declare
    your url mapping instead of physically structuring your source depending
    on the url scheme.

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

    >
    > LOL, point taken.
    >
    > So to summarize: it should be possible to get exactly what I want, but
    > it's not advisable, because the frameworks aren't designed to work
    > like this. That makes sense.
    > I want to thank you guys for all the advice, I have a lot of
    > frameworks and template-engines to look into now, I'll have a look at
    > all that you mentioned to see which one suits me best. Judging from
    > the quick and thorough support from the Python community, I think I
    > will stick with a proven framework and/or style, so I can ask a
    > question once in a while.


    May I suggest Pylons ? It's not yet the more stable and finished option,
    but from what I know of 'classic' ASP and how you explained to usually
    work, I think you might be confortable with it.

    > There is probably less sense in trying to pick up a new language while
    > at the same time trying to stick to the methods I used in an old
    > language.


    Hear hear !-)

    > But hey, I thought, maybe a thing like this already exists
    > exactly like I want it... Ah well.
    >
    > Thanks again all, take care!
    >
    > Erik
    >
    >
    >
     
    Bruno Desthuilliers, May 27, 2008
    #15
  16. On 25 mai, 18:58, wrote:
    > 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


    Hi,

    You can take a look at Karrigell (http://karrigell.sourceforge.net).
    It's very simple to install, stable (the first version was published
    in 2002) and among the programming styles provided you will find
    "Python Inside HTML" which is as close as you can get to PHP or ASP

    ===================
    <h1>Squares</h1>
    <%
    for i in range(10):
    print "%s :<b>%s</b>" %(i,i*i)
    %>
    ===================

    Regards,
    Pierre
     
    Pierre Quentel, May 27, 2008
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tarkin
    Replies:
    2
    Views:
    322
    Chris Smith
    Jun 10, 2006
  2. VB
    Replies:
    0
    Views:
    401
  3. Tamer Higazi
    Replies:
    1
    Views:
    268
  4. Rajive Narain
    Replies:
    0
    Views:
    2,078
    Rajive Narain
    Sep 18, 2009
  5. neha shena
    Replies:
    1
    Views:
    281
    Dennis Lee Bieber
    Oct 29, 2010
Loading...

Share This Page