Web programming ...

  • Thread starter Sarah Tanembaum
  • Start date
S

Sarah Tanembaum

Is python good for creating Web application? I do like the OOness of Python,
as a newbie, I'm trying to find out if Python has all its necessary
modules/utilities for Web programming just as extensive as, say, PHP or
Ruby(some say that Ruby is not ready for this sort of application and is not
yet mature as Perl, Python, and PHP - is it true?).
 
M

Mark J. Nenadov

Is python good for creating Web application? I do like the OOness of Python,
as a newbie, I'm trying to find out if Python has all its necessary
modules/utilities for Web programming just as extensive as, say, PHP or
Ruby(some say that Ruby is not ready for this sort of application and is not
yet mature as Perl, Python, and PHP - is it true?).

Sasha,

Yes. Python is good for creating web applications. Have you ever heard of
Zope? I strongly suggest that you have a look at it.
 
M

Moxley Stratton

Sarah said:
Is python good for creating Web application? I do like the OOness of Python,
as a newbie, I'm trying to find out if Python has all its necessary
modules/utilities for Web programming just as extensive as, say, PHP or
Ruby(some say that Ruby is not ready for this sort of application and is not
yet mature as Perl, Python, and PHP - is it true?).

PHP is a more straight-forward web development language for a newbie
because it has been developed and marketed for the web developer in mind.

However, this is how I see the difference: PHP provides only one
built-in basic approach to web application development: a web server
module (or CGI) plus a page template model, similar to asp and jsp, plus
the PHP language. Python doesn't provide any web application development
model built-in. You either develop Python web applications as CGI
scripts-- which isn't very popular because of performance issues-- or
you work with a web application model that somebody has developed.
Because Python doesn't enforce any particular web development model,
developers are free to take any approach that has been developed, or
they may develop their own model. This creates the potential for more
sophisticated applications, but it almost always makes it more difficult
than PHP to create small ones. It also means that as a newbie, you have
to spend the time to pick a model to start with.

Another thing I'd like to say about the PHP model is that it is very
mature and well-known.

I'm a PHP developer who has been tinkering around with Python for some
time now. I've been researching Webware as a candidate for my primary
Python web development model.
 
S

Sarah Tanembaum

Thanks Moxley. I too just finish with a very small project with PHP, Family
Photo Album.

Where can I find any good example of Python web programming - small,
concise and easy to follow, to re-write my PHP apps in Python.

I'm using MySQL to store the photos information.

Thanks
 
I

Irmen de Jong

Chris said:
I guess it depends on what you mean by "web application"... I've never
been able to find decent SOAP support, or something that can grok a WSDL
file, for example.

Web Application = an application that is accessed by the users through
a web interface in a browser.
I think you're referring to a "Web Service"... whatever that may be.


--Irmen
 
N

Nelson Minar

Chris Herborth said:
I've never been able to find decent SOAP support, or something that
can grok a WSDL file, for example.

I think the original request was more about HTML web applications.

SOAP and WSDL support is getting better for python; check out recent
versions of pywebsvcs. There is now WSDL support. It's not perfect
yet, but it is better than a year ago.
http://pywebsvcs.sourceforge.net/
 
S

Sarah Tanembaum

I'm refering to HTML/XML Web application traditionally written with
scripting language such as ASP, JSP, PHP, and Perl.

Thanks
 
G

Guest

Just finished a semester-long project for Database Systems class using
Python Server Pages and Python code imports. Interesting... I like how they
work in general and it all interfaced perfectly with the Postgres DB API,
but PSP in general could use more documentation.

Right now... I'd say JSP and PSP are tied in my experience.
 
R

Remi Delon

Is python good for creating Web application? I do like the OOness of Python,
as a newbie,

Well, if you like object-oriented programming in Python then I
strongly suggest that you take a look at CherryPy
(http://www.cherrypy.org).
You will feel right at home :)
Developping your web-app will feel as if you were developing a regular
OO python app.


Remi.
 
H

Heiko Wundram

Am Mittwoch, 5. Mai 2004 17:49 schrieb Sarah Tanembaum:
Is python good for creating Web application? I do like the OOness of
Python, as a newbie, I'm trying to find out if Python has all its necessary
modules/utilities for Web programming just as extensive as, say, PHP or
Ruby(some say that Ruby is not ready for this sort of application and is
not yet mature as Perl, Python, and PHP - is it true?).

If you're interested in CherryPy, you might as well have a look at CheesyPy
(http://sourceforge.net/projects/CheesyPy). Somewhat similar to CherryPy, but
different (and IMHO cleaner, but who am I to say? I developed it ;))
implementation of the OO-framework on top of the base Web-Server.

CheesyPy is in no way finished yet (not even documented well enough, but
browse the source luke!), but the lower-level code which is demonstrated in a
simple sample application at the root of the package works out of the box
already.

The main difference between CherryPy and CheesyPy is the fact that CheesyPy
doesn't use a precompiler, but rather __metaclass__es to pull in all classes
which are to be displayed and as thus doesn't feature embedding HTML-code in
a file, but rather (a so far incomplete) HTMLgen-like html generation,
features builtin session handling without use of cookies, and allows you to
define Plugins for web-pages which can be easily plugged into a class. These
plugins may define additional functionality (such as the included example
Config plugin, which reads a configuration file and offers access to it
through the class instance). The web-server supports Keep-Alive and verbose
error output on internal server errors.

HTH!

Heiko.
 
H

Heiko Wundram

Am Donnerstag, 6. Mai 2004 16:38 schrieb Heiko Wundram:

Whoops, I misspelled the project name at sourceforge. The URL should've been:

http://sourceforge.net/projects/cheesypy

btw., if anybody is using this package and can't contact me, the eMail-Address
stated in that package has expired (as I no longer work there), and you can
now contact me at (e-mail address removed)... I'll upload a new version of the
package with updated contact information soon.

Heiko.
 
R

Remi Delon

If you're interested in CherryPy, you might as well have a look at CheesyPy
(http://sourceforge.net/projects/CheesyPy). Somewhat similar to CherryPy, but
different (and IMHO cleaner, but who am I to say? I developed it ;))
implementation of the OO-framework on top of the base Web-Server.

CheesyPy is in no way finished yet (not even documented well enough, but
browse the source luke!), but the lower-level code which is demonstrated in a
simple sample application at the root of the package works out of the box
already.

The main difference between CherryPy and CheesyPy is the fact that CheesyPy
doesn't use a precompiler


I'd like add a few comments about this:

- "Cleanliness":

I won't comment on the cleanliness of the "implementation" of the
tools themselves because I don't think it is very relevant. What
really matters is the cleanliness of the code that users write with
the tools (for their web applications).
Some tools will naturally encourage cleaner code than others, just
like python naturally encourages cleaner code than other languages
(who said "Perl" :)).
In that area, I think that CherryPy has managed to keep python's
qualities.
Even though it adds another layer on top of python, developping a web
app with it still very much like writing regular python code and it
still encourages clean code: users almost never have to write extra
lines of code that don't have anything to do with the problem they're
trying to solve but that are needed because of the tool itself.


Also, people usually misunderstand the following two points about
CherryPy:

- "Text generation":

I see 3 common ways of dynamically generating HTML (or any other type
of text). Let's say we have a variable called "name" that contains
"world". The 3 common ways are:
(1) Embedding HTML in python: return "<html><body>Hello,
%s</body></html" % name
(2) Embedding python in HTML (templating language):
<html><body>Hello, $name$</body></html> (or some other notation
depending on the templating language). I would also put things like
XSLT in that category.
(3) The "programmatic" approach: return HTML(BODY("Hello, %s"
% world)) (or some other notation)

CherryPy doesn't force you to use one approach or the other
because for each page (or even each bit of text) you can use whatever
approach you prefer. If you want to use a templating language,
CherryPy comes with a default one but you can also use another one if
you want (some people use Cheetah).
I usually prefer approach (1) if the page has lots of dynamic
data and little static date, and approach (2) if the page has lots of
static data and little dynamic data.

- The "compiler" effect:

A lot of people are initially put off by the fact that developing a
site in CherryPy requires a compilation step (it feels like going back
to the "C" age, doesn't it :).
Well, in practice, this is never a problem ... The compilation step is
really fast (even for big sites) and I just have a 2-line script that
compiles the site and starts it ...
This compiler approach does have some benefits (otherwise it wouldn't
be there :): Of course, speed is one of them, but also, several
popular CherryPy features (like aspects) couldn't be easily
implemented without this approach.


Remi.
 
H

has

I see 3 common ways of dynamically generating HTML (or any other type
of text). Let's say we have a variable called "name" that contains
"world". The 3 common ways are:
(1) Embedding HTML in python: return "<html><body>Hello,
%s</body></html" % name
(2) Embedding python in HTML (templating language):
<html><body>Hello, $name$</body></html> (or some other notation
depending on the templating language). I would also put things like
XSLT in that category.
(3) The "programmatic" approach: return HTML(BODY("Hello, %s"
% world)) (or some other notation)

There's a fourth option: compile your HTML template into a Python
object model that can be manipulated programmatically. IMO this is by
far the best approach for template-based rendering: it's extremely
simple yet powerful, highly portable (not being bound to any
particular web framework) and completely separates presentation logic
from markup (other approaches typically separate only model logic).

See PyMeld, Nevow.Renderer and my own HTMLTemplate
<http://freespace.virgin.net/hamish.sanderson/htmltemplate.html> (you
can find various scripts using HTMLTemplate around my site).

HTH
 
P

Peter Luciak

Is python good for creating Web application? I do like the OOness of Python,
as a newbie, I'm trying to find out if Python has all its necessary
modules/utilities for Web programming just as extensive as, say, PHP or
Ruby(some say that Ruby is not ready for this sort of application and is not
yet mature as Perl, Python, and PHP - is it true?).

Just came across this one, looks pretty good:

http://www.ypsolog.com/docs/comp/other/pythonweb.html

P.
 

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

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top