The best way to do web apps with Python?

W

worzel

What is the best way to web developemnt with Python? Is there anything close to PHP style in-page script placement that can create and use other Python objects? I am not really interested in Zope (I believe that is more a CMS than anything else?) I am also looking for something a little more structured than a series of CGI Scripts.

While on the topic - what is the expectataion of Python for this kind of stuff? Would one use Python for certain other things but turn to PHP for web apps - or would one use their Python skills in place of PHP?

TIA
 
P

Paul Rubin

worzel said:
What is the best way to web developemnt with Python? Is there
anything close to PHP style in-page script placement that can create
and use other Python objects? I am not really interested in Zope (I
believe that is more a CMS than anything else?) I am also looking
for something a little more structured than a series of CGI Scripts.

Basically, yes, there are various Python template systems similar to
PHP. I won't name them because other people more knowledgeable than
me will do a better job than I could. I'll say that Python is a
better language than PHP, but getting a basic dynamic web app running
in PHP is much simpler than it is in Python. Python's advantage
starts to shine once the app gets complicated.
While on the topic - what is the expectataion of Python for this
kind of stuff? Would one use Python for certain other things but
turn to PHP for web apps - or would one use their Python skills in
place of PHP? TIA

It's sort of a difficult trade-off and it depends a lot on your
application, who will develop and maintain it, who will use it, where
it will be deployed, etc. Lots more people know PHP than Python, PHP
is easier to get started with, and cheap PHP hosting is available all
over. So if you're building some simple app that you want to
distribute widely and run everywhere, PHP is attractive. If you're
building a complex system which you'll run on a server that you have
more control over, and you'll have relatively high-powered developers
on hand to maintain the code, Python beats PHP.
 
P

Pierre Quentel

worzel a écrit :
What is the best way to web developemnt with Python? Is there anything
close to PHP style in-page script placement that can create and use
other Python objects? I am not really interested in Zope (I believe that
is more a CMS than anything else?) I am also looking for something a
little more structured than a series of CGI Scripts.

There are quite a few web frameworks in Python, see
http://www.python.org/moin/WebProgramming

I'm biaised in favour of Karrigell (http://karrigell.sourceforge.net),
the "Python Inside HTML" pages look and behave very much like PHP

Regards,
Pierre
 
R

Rob Emmons

<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>What is </FONT><FONT face=Arial size>

Just FYI -- the post you posted was in HTML -- you might want to avoid
this in the future. 99% of all posts to news groups are in text, not
html. Html is hard for everyone to read with normal news readers and not
usually of any extra value. It's also more of a security risk to read it --
because there is more potential for exploitation.

Anyway, just thought I'd mention it if you didn't know.

Take care,
Rob
 
S

Steve Holden

worzel said:
What is the best way to web developemnt with Python? Is there anything
close to PHP style in-page script placement that can create and use
other Python objects? I am not really interested in Zope (I believe that
is more a CMS than anything else?) I am also looking for something a
little more structured than a series of CGI Scripts.
More ways than you can shake a stick at, but nowadays you should
consider using WSGI if you want your code to be portable across many
frameworks. The Web SIG worked very hard last year on defining this
gateway interface, with the intention that it should become widely
available, and implementations are available now on environments as
diverse as mod_python and CherryPy.

You can read about it in Philip Eby's excellent PEP at

http://www.python.org/peps/pep-0333.html
While on the topic - what is the expectataion of Python for this kind of
stuff? Would one use Python for certain other things but turn to PHP for
web apps - or would one use their Python skills in place of PHP?
Python is a real programming language, whereas PHP was originally
intended as a simple way of scripting web content. Since then it has
grown to encompass many of the same features as Python, but since they
were retrofitted rather than designed in they are sometimes kind of
clunky (as, IMHO, is Perl, although in a different way).

But there's a lot of good work been done in both PHP and Perl, and I'd
usually recommend using existing functionality in either language over a
just-for-the-sake-of-it rewrite in Python. But that could just be
because I don't like re-inventing wheels.

regards
Steve
 
J

Joe Francia

worzel said:
What is the best way to web developemnt with Python? Is there
anything close to PHP style in-page script placement that can create
and use other Python objects? I am not really interested in Zope (I
believe that is more a CMS than anything else?) I am also looking for
something a little more structured than a series of CGI Scripts.

While on the topic - what is the expectataion of Python for this kind
of stuff? Would one use Python for certain other things but turn to
PHP for web apps - or would one use their Python skills in place of
PHP?

TIA

You may want to look here for some thoughts on the matter:
http://pyre.third-bit.com/pyweb/index.html

I lean towards Quixote and/or CherryPy, with ZODB as the storage. Both
are conceptually similar (I'm comparing v2 of both), but I favor Quixote
just slightly more, mostly for Quixote's better form handling. Cheetah
is a very nice templating package, but in Quixote I just use its own
PTL, since it's built-in.

If you wanted to stick with PHP for some reason, Drupal is a very nicely
designed framework (or CivicSpace, which is developed in parallel with
Drupal, with a number of added-on features).

Quixote: http://www.mems-exchange.org/software/quixote/
CherryPy: http://www.cherrypy.org/
ZODB: http://zope.org/Wikis/ZODB/FrontPage
Cheetah: http://www.cheetahtemplate.org/
Drupal: http://www.drupal.org/
CivicSpace: http://www.civicspacelabs.org/

jf
 
W

worzel

Holy Moly - there's quite a few choices out there! I like the look of
Karrigel for my immediate needs.

Looking forward to the day there is a more 'j2ee' like standard in place for
Python - looks like this is in the works.

Thanks for all the feedback guys.



What is the best way to web developemnt with Python? Is there anything close
to PHP style in-page script placement that can create and use other Python
objects? I am not really interested in Zope (I believe that is more a CMS
than anything else?) I am also looking for something a little more
structured than a series of CGI Scripts.

While on the topic - what is the expectataion of Python for this kind of
stuff? Would one use Python for certain other things but turn to PHP for web
apps - or would one use their Python skills in place of PHP?

TIA
 
I

Ian Bicking

Steve said:
More ways than you can shake a stick at, but nowadays you should
consider using WSGI if you want your code to be portable across many
frameworks. The Web SIG worked very hard last year on defining this
gateway interface, with the intention that it should become widely
available, and implementations are available now on environments as
diverse as mod_python and CherryPy.

You can read about it in Philip Eby's excellent PEP at

http://www.python.org/peps/pep-0333.html

WSGI isn't really something an application programmer can use; or at
least it's not likely to be a very satisfying experience if they do.
I'm optimistic that at some point most of the actively developed Python
web frameworks we have now will be ported to WSGI. Ultimately, I think
WSGI should be something a more casual Python web programmer wouldn't
even realize exists.
 
C

Carlos Ribeiro

What is the best way to web developemnt with Python? Is there anything close
to PHP style in-page script placement that can create and use other Python
objects? I am not really interested in Zope (I believe that is more a CMS
than anything else?) I am also looking for something a little more
structured than a series of CGI Scripts.

While on the topic - what is the expectataion of Python for this kind of
stuff? Would one use Python for certain other things but turn to PHP for web
apps - or would one use their Python skills in place of PHP?

Check CherryPy - www.cherrypy.org. It's clean, light, and best of all,
includes its own webserver. You can publish a small site with almost
*no* configuration effort, and you have to write *very little code*.
It's also natively multi-threaded, and supports advanced stuff such as
gzip compression on the fly and XMLRPC.

Disclaimer: I'm a contributor to CherryPy, so I'm biased. But I had
evaluated both Karirgel and Quixote before settling up on CherryPy,
and I see no reason to change.

--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: (e-mail address removed)
mail: (e-mail address removed)
 
J

Jon Perez

worzel said:
What is the best way to web developemnt with Python? Is there anything
close to PHP style in-page script placement that can create and use
other Python objects?

Spyce ( http://spyce.sf.net ) is what you're looking for. I
was looking exactly for the same thing as you are - a PHP workalike -
and tried around half a dozen or so alternatives before I settled
upon Spyce as the best one.

If Spyce's [[ and ]] delimiters are not to your liking, you can
actually switch to using <% and %> without any problem. Spyce
also handles the Python indent issue quite nicely and elegantly,
imo, while you can use the free and open source SciTE text editor
to separately syntax highlight Spyce source code + Javascript + HTML
very nicely (config file tweaking required).
what is the expectataion of Python for this kind of
stuff? Would one use Python for certain other things but turn to PHP for
web apps - or would one use their Python skills in place of PHP?

Python can be a full (and superior) replacement for PHP. The only
caveat would be third party hosting support.

The following post by on the Spyce mailing list (by Andy of
Neotitans.com web development) explains why:

"One major roadblock to Spyce and other Python server side
technologies seeing acceptance on the scale of PHP is the
fact that mod_python deployment on 3rd party shared hosting
solutions is more complex and involved than mod_php. Apparently,
security considerations mean that each mod_python user will need
to get their own instance of an Apache server acting as a proxy
behind a central instance of an Apache server (which is what's
responsible for accepting requests at the shared server's http port).

A per-shared user Spyce proxy server approach would likely be
more economical (of server resources) and more easily set up than
multiple mod_python-enabled Apache server instances.

If your hosting solution will permit you to have your own
long-running processes (afaik, most won't :-( ), and if they
are willing make the necessary httpd.conf mods to pass Spyce
page requests over to your own instance of the Spyce proxy
server or their .htaccess setup allows you to do that yourself,
then you're all set.

I'm also happy to report that Spyce CGI works great on any
hosting solution that supports CGI and has Python installed.
This means that virtually all Linux-based hosting solutions
(including those ultra-cheap shared server ones) will support
Spyce CGI.

It would seem that FastCGI support is probably the hardest to
come by."
 
P

Paul Rubin

Steve Holden said:
You can read about it in Philip Eby's excellent PEP at

http://www.python.org/peps/pep-0333.html

I looked at this and I have the impression that it tries to do
something worthwhile, but I can't tell precisely what. The "rationale
and goals" section explains good reasons why it doesn't do various
certain things. What's not explained is what DOES it do. The only
thing I can tell is that it connects to an abstracted web server, and
builds up what looks like traditional CGI variables from the incoming
requests.
 
I

Ian Bicking

Paul said:
I looked at this and I have the impression that it tries to do
something worthwhile, but I can't tell precisely what. The "rationale
and goals" section explains good reasons why it doesn't do various
certain things. What's not explained is what DOES it do. The only
thing I can tell is that it connects to an abstracted web server, and
builds up what looks like traditional CGI variables from the incoming
requests.

It's really meant for web framework developers (as opposed to web
application developers, who use web frameworks). Of course it's a fuzzy
line, and people cross back and forth, especially since most all of it
is open source.

So basically it is what you were thinking -- it's a way to connect a web
server to a web application, for any server or application, including
current servers and applications (not just ones that are developed in
the future). It can be a bit more interesting when you delve into
middleware, which are programs that modify the request before handing it
off to another application. But while that opens up interesting
possibilities (I've used that technique a fair amount in WSGIKit:
http://svn.colorstudy.com/trunk/WSGIKit/ ), but it's not incredibly magical.

Mostly, it's the first forward movement we've had in a very long time,
even if the movement isn't huge. It provides a foundation for further
standardization.

WSGI compliance also has some other potential benefits, like encouraging
environment decoupling, and making mock requests easier to produce and
responses easier to consume. But those are somewhat vague side effects.
 

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
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top