Python for web ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • black

    Python for web ?

    Howdy everyone~

    i heard Python could be used in web programming and aftering searching many docs just found something on Python and CGI. the fact is i know nothing about CGI and most of my projects(both of company and myself) are established with PHP and ASP. now the questions come:

    1. Could Python be used in web programming ? (i guess yes ?)
    2. If the answer of above is yes, then can we programms with Python in both server and client side or either ?
    3. I used to programming with PHP and ASP, could Python take the place of them ?
    4. If answer of 3 is ye
    s, where can i get some reference and code examples about it ?(Ooops Python Reference are all about CGIs !)
    thanx in advance~


    ---------------------------------
    Do you Yahoo!?
    Free Pop-Up Blocker - Get it now
  • Jay O'Connor

    #2
    Re: Python for web ?

    black wrote:
    [color=blue]
    > Howdy everyone~
    >
    > i heard Python could be used in web programming and aftering searching
    > many docs just found something on Python and CGI. the fact is i know
    > nothing about CGI and most of my projects(both of company and myself)
    > are established with PHP and ASP. now the questions come:
    >
    > 1. Could Python be used in web programming ? (i guess yes ?)
    > 2. If the answer of above is yes, then can we programms with Python in
    > both server and client side or either ?[/color]


    If by 'client side' you mean 'Python embedded in the HTML page' like
    PHP, I think it's possible but I tend to avoid it. First off, for any
    such HTML embedded scripting you have to have a server that while parse
    and execute the script. A lot of ISPs offer that for PHP but I'm not
    sure about for Python. More importantly, though, I'm not a big fan of
    the architecture of having HTML code interspersed with script coding. I
    think you'd end up with a better software design with a normal
    CGI-template approach


    Comment

    • Peter Hansen

      #3
      Re: Python for web ?

      Jay O'Connor wrote:[color=blue]
      >
      > black wrote:
      >[color=green]
      > > Howdy everyone~
      > >
      > > i heard Python could be used in web programming and aftering searching
      > > many docs just found something on Python and CGI. the fact is i know
      > > nothing about CGI and most of my projects(both of company and myself)
      > > are established with PHP and ASP. now the questions come:
      > >
      > > 1. Could Python be used in web programming ? (i guess yes ?)
      > > 2. If the answer of above is yes, then can we programms with Python in
      > > both server and client side or either ?[/color]
      >
      > If by 'client side' you mean 'Python embedded in the HTML page' like
      > PHP, I think it's possible but I tend to avoid it.[/color]

      Isn't that quite clearly *server-side*, not client side? AFAIK, all
      PHP pages have the server doing the page generation, not the client.

      Client-side would be like Java or Javascript is typically used. The
      answer is still "yes", but it's really not a workable solution in
      general because (a) the client machine needs Python installed and
      registered for COM stuff, and (b) there are serious security concerns
      doing this since Python doesn't have the security restrictions that
      Javascript and Java do.
      [color=blue]
      > First off, for any
      > such HTML embedded scripting you have to have a server that while parse
      > and execute the script. A lot of ISPs offer that for PHP but I'm not
      > sure about for Python. More importantly, though, I'm not a big fan of
      > the architecture of having HTML code interspersed with script coding. I
      > think you'd end up with a better software design with a normal
      > CGI-template approach[/color]

      Agreed on all that...

      -Peter

      Comment

      • Jay O'Connor

        #4
        Re: Python for web ?

        Peter Hansen wrote:
        [color=blue]
        >Jay O'Connor wrote:
        >
        >[color=green]
        >>black wrote:
        >>
        >>
        >>[color=darkred]
        >>>Howdy everyone~
        >>>
        >>>i heard Python could be used in web programming and aftering searching
        >>>many docs just found something on Python and CGI. the fact is i know
        >>>nothing about CGI and most of my projects(both of company and myself)
        >>>are established with PHP and ASP. now the questions come:
        >>>
        >>>1. Could Python be used in web programming ? (i guess yes ?)
        >>>2. If the answer of above is yes, then can we programms with Python in
        >>>both server and client side or either ?
        >>>
        >>>[/color]
        >>If by 'client side' you mean 'Python embedded in the HTML page' like
        >>PHP, I think it's possible but I tend to avoid it.
        >>
        >>[/color]
        >
        >Isn't that quite clearly *server-side*, not client side? AFAIK, all
        >PHP pages have the server doing the page generation, not the client.
        >
        >[/color]

        Yeah, it's still server side as far as where the processing is done.
        Since the OP point of reference was ASP and PHP, neither of which are
        true client-side technologies either, I made the assumption that by
        'client-side' he was thinking in terms of the client presentation
        [color=blue]
        >Client-side would be like Java or Javascript is typically used. The
        >answer is still "yes", but it's really not a workable solution in
        >general because (a) the client machine needs Python installed and
        >registered for COM stuff, and (b) there are serious security concerns
        >doing this since Python doesn't have the security restrictions that
        >Javascript and Java do.
        >
        >[/color]

        Correct, my other fav language is Smalltalk and there are a few plugins
        for client side Smalltalk as well, but since they require users to
        download a plugin, I really don't see them as valid development models
        other than for internal usage for a paricular business or something, not
        general internet usage.
        [color=blue][color=green]
        >>First off, for any
        >>such HTML embedded scripting you have to have a server that while parse
        >>and execute the script. A lot of ISPs offer that for PHP but I'm not
        >>sure about for Python. More importantly, though, I'm not a big fan of
        >>the architecture of having HTML code interspersed with script coding. I
        >>think you'd end up with a better software design with a normal
        >>CGI-template approach
        >>
        >>[/color]
        >
        >Agreed on all that...
        >[/color]

        Back in the early 90s it seemed people were starting to take good
        software design, OOA and OOD, seperation of "Human Interface" from
        "Business Domain" etc...seriously . Then the web got big and all that
        seemed to go out the window..

        Comment

        • François Pinard

          #5
          Re: Python for web ?

          [Jay O'Connor][color=blue]
          > black wrote:[/color]
          [color=blue][color=green]
          > >1. Could Python be used in web programming ? (i guess yes ?)[/color][/color]

          Yes, a lot! :-)
          [color=blue][color=green]
          > >2. If the answer of above is yes, then can we programms with Python in
          > >both server and client side or either ?[/color][/color]

          I guess yes to both. For my own usages, I use Python servers where
          Python code is easily put within HTML pages. If I really wanted to have
          Python executed on the client side browsers, I would likely follow the
          Jython path, as Jython is Python over Java, and some Web browsers are
          already able to run Java. (I did not really try Jython yet, however.)
          [color=blue]
          > If by 'client side' you mean 'Python embedded in the HTML page' like
          > PHP, I think it's possible but I tend to avoid it. First off, for any
          > such HTML embedded scripting you have to have a server that while parse
          > and execute the script.[/color]

          If you design carefully, the overhead could be quite negligible, besides
          the cycles burned by the very execution of scripts. I would not really
          see this as an impediment, in practice.
          [color=blue]
          > More importantly, though, I'm not a big fan of the architecture of
          > having HTML code interspersed with script coding. I think you'd end
          > up with a better software design with a normal CGI-template approach[/color]

          Indeed. Templates allow a much nicer separation of the work between
          the Web designers and artists on one side, and programmers on the other
          side. Some templating systems are heavier than others (for both humans
          and machines), one has to be careful when choosing or designing them.

          --
          François Pinard http://www.iro.umontreal.ca/~pinard

          Comment

          • Jay O'Connor

            #6
            Re: Python for web ?

            François Pinard wrote:
            [color=blue]
            >[Jay O'Connor]
            >
            >[color=green]
            >>black wrote:
            >>[/color]
            >
            >[color=green][color=darkred]
            >>>2. If the answer of above is yes, then can we programms with Python in
            >>>both server and client side or either ?
            >>>
            >>>[/color][/color]
            >
            >I guess yes to both. For my own usages, I use Python servers where
            >Python code is easily put within HTML pages. If I really wanted to have
            >Python executed on the client side browsers, I would likely follow the
            >Jython path, as Jython is Python over Java, and some Web browsers are
            >already able to run Java. (I did not really try Jython yet, however.)
            >
            >[/color]

            I'd forgotten Jython.

            [color=blue][color=green]
            >> First off, for any
            >>such HTML embedded scripting you have to have a server that while parse
            >>and execute the script.
            >>
            >>[/color]
            >
            >If you design carefully, the overhead could be quite negligible, besides
            >the cycles burned by the very execution of scripts. I would not really
            >see this as an impediment, in practice.
            >
            >[/color]

            I was mostly yhinking availibility, not performance. If you are using
            an ISP, then any server-side processing has to be enabled by the ISP and
            that may or may not be possible depending on your ISP
            [color=blue]
            >
            >[color=green]
            >>More importantly, though, I'm not a big fan of the architecture of
            >>having HTML code interspersed with script coding. I think you'd end
            >>up with a better software design with a normal CGI-template approach
            >>
            >>[/color]
            >
            >Indeed. Templates allow a much nicer separation of the work between
            >the Web designers and artists on one side, and programmers on the other
            >side. Some templating systems are heavier than others (for both humans
            >and machines), one has to be careful when choosing or designing them.
            >
            >[/color]

            Same here. I do the backend programming and usually give the designer a
            page (See these marks? Don't touch them, the rest of the page is
            yours) Works well because I'm *not* a graphices designer and I get much
            better results when I make it work and I give it to a friend to make it
            look good.



            Comment

            Working...