Python for web ?

B

black

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~
 
J

Jay O'Connor

black said:
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 ?


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
 
P

Peter Hansen

Jay said:
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.

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

Agreed on all that...

-Peter
 
?

=?iso-8859-1?Q?Fran=E7ois?= Pinard

[Jay O'Connor]
black wrote:

Yes, a lot! :)

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

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

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

Jay O'Connor

Peter said:
Jay O'Connor wrote:



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

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

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.
Agreed on all that...

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

Jay O'Connor

François Pinard said:
[Jay O'Connor]

black wrote:

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

I'd forgotten Jython.

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.

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

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,476
Latest member
blackwatermelon

Latest Threads

Top