| Author |
Message |
Christos "TZOTZIOY&q *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 211
|
Posted: Fri Feb 04, 2005 11:07 pm Post subject:
Re: advice needed for simple python web app
|
|
|
On 03 Feb 2005 22:31:43 -0800, rumours say that Paul Rubin
<http://phr.cx@NOSPAM.invalid> might have written:
[Dan Perl thinks about publishing to the web a script that could be misused by
spammers, so Paul advises him to watch out.]
| Quote: | There used
to be some similar perl scripts running all over the place until that
happened.
|
Those were pure perl scripts. This will be a Perl python script, so no problem.
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually... |
|
| Back to top |
|
 |
Ray Cote *nix forums beginner
Joined: 22 Jun 2005
Posts: 4
|
Posted: Fri Feb 04, 2005 10:30 pm Post subject:
Re: advice needed for simple python web app
|
|
|
At 8:51 AM -0800 2/4/05, Paul Rubin wrote:
| Quote: | "Dan Perl" <danperl@rogers.com> writes:
This matches pretty much what I've decided to do. I'll start with cgi and
CGIHTTPServer because I'll learn more from that and then move to a
framework, quite likely CherryPy, although by that time I may change my
choice. Philip Greenspun's book looks good and I'll have to go through it.
Thanks for the advice.
You might also look at the docs for HTML::Mason (www.masonhq.com) to
get a look at a reasonably mature template system, even if you don't
plan to use it (because it's in Perl and not Python).
|
There's a Python port of HTML::Mason called Myghty.
A fairly new project. I've just played around with it a bit
Well worth a look: <http://www.myghty.org/>
--
Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com |
|
| Back to top |
|
 |
Ant *nix forums beginner
Joined: 12 Aug 2005
Posts: 44
|
Posted: Fri Feb 04, 2005 5:32 pm Post subject:
Re: advice needed for simple python web app
|
|
|
| Quote: | You might also look at the docs for HTML::Mason (www.masonhq.com) to
get a look at a reasonably mature template system, even if you don't
plan to use it (because it's in Perl and not Python). I'm not sure
if
CherryPy is directly comparable. I haven't yet used any of the
Python
template systems.
|
Mason is available for python
http://www.myghty.org/ |
|
| Back to top |
|
 |
Jeff Reavis *nix forums beginner
Joined: 18 Apr 2005
Posts: 6
|
|
| Back to top |
|
 |
Paul Rubin *nix forums Guru
Joined: 28 Feb 2005
Posts: 1197
|
Posted: Fri Feb 04, 2005 3:51 pm Post subject:
Re: advice needed for simple python web app
|
|
|
"Dan Perl" <danperl@rogers.com> writes:
| Quote: | This matches pretty much what I've decided to do. I'll start with cgi and
CGIHTTPServer because I'll learn more from that and then move to a
framework, quite likely CherryPy, although by that time I may change my
choice. Philip Greenspun's book looks good and I'll have to go through it.
Thanks for the advice.
|
You might also look at the docs for HTML::Mason (www.masonhq.com) to
get a look at a reasonably mature template system, even if you don't
plan to use it (because it's in Perl and not Python). I'm not sure if
CherryPy is directly comparable. I haven't yet used any of the Python
template systems. |
|
| Back to top |
|
 |
Dan Perl *nix forums beginner
Joined: 19 Feb 2005
Posts: 32
|
Posted: Fri Feb 04, 2005 1:20 pm Post subject:
Re: advice needed for simple python web app
|
|
|
"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote in message
news:7xis58reac.fsf@ruckus.brouhaha.com...
| Quote: | If you're just trying to get a conceptual understanding of web
programming, I suggest you start with cgi.
Next you might want to read Philip and Alex's Guide to Web Publishing:
http://philip.greenspun.com/panda/
It's out of date and the examples use Tcl and Oracle instead of
Python, but it's still a good explanation of how database-driven web
sites work. The rest (like languages frameworks) is just a matter of
picking some implementation parameters.
|
This matches pretty much what I've decided to do. I'll start with cgi and
CGIHTTPServer because I'll learn more from that and then move to a
framework, quite likely CherryPy, although by that time I may change my
choice. Philip Greenspun's book looks good and I'll have to go through it.
Thanks for the advice. |
|
| Back to top |
|
 |
Fred Pacquier *nix forums beginner
Joined: 11 Apr 2005
Posts: 12
|
Posted: Fri Feb 04, 2005 10:45 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Dan Perl" <danperl@rogers.com> said :
| Quote: | This is exactly the kind of summary that I think should be in a
WebProgrammingShootOut (see another one of my postings in this thread)
but I failed to find such a summary. Thanks, Brian! Anyone can add
to the list?
|
I myself am also into (very) simple web apps and hence simple, easy-to-
learn web frameworks.
CherryPy is a very nice kit, still simple enough but already (IMO)
somewhat on the powerful, batteries-included side for a beginner -- and,
as you noted, a bit under-documented at the moment.
There are a couple of others that will get you started without too much
effort (in part because simplicity is one of their design points) and
without limiting you too much either : Karrigell by Pierre Quentel and
Snakelets by Irmen de Jong.
They're somewhat similar in scope and concept : it will be mostly a
matter of which one 'fits your brain' best. Myself I settled on
Snakelets, not least because it has some of the better docs out there.
| Quote: | BTW, there are other people who seem to have been also confused by the
wide spectrum of choices for this problem:
|
That's an old debate in the Python world, yes. The "one true way to do
it" motto of the language itself doesn't apply to its web frameworks :)
See the recent "Ruby on Rails" threads for a discussion of whether this
is good or bad...
--
YAFAP : http://www.multimania.com/fredp/ |
|
| Back to top |
|
 |
Dave Cook *nix forums addict
Joined: 20 Feb 2005
Posts: 74
|
Posted: Fri Feb 04, 2005 7:46 am Post subject:
Re: advice needed for simple python web app
|
|
|
On 2005-02-04, Dan Perl <danperl@rogers.com> wrote:
| Quote: | I have a pretty simple python script and I would like to turn it into a web
application but web apps are a domain I know very little about. I know that
Twisted, CherryPy, Plone and Zope exist but not exactly what they do. I
|
I think CherryPy is the lightest and easiest if you need a built-in server.
I was impressed by its intuitiveness, though I don't really like the default
templating system.
I'm using Nevow (slick!) and Twisted now, but you pay for the flexiblility
with a steep learning curve, and lack of documentation and API stability are
an issue with Nevow.
Inspired by an example on Bruce Eckel's blog, I tried writing a web app with
only the server that comes with the standard lib, but it was just too hard
for me to build an app starting from that low a level. The frameworks help a
lot here.
Dave Cook |
|
| Back to top |
|
 |
Paul Rubin *nix forums Guru
Joined: 28 Feb 2005
Posts: 1197
|
Posted: Fri Feb 04, 2005 6:10 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Dan Perl" <danperl@rogers.com> writes:
| Quote: | This is exactly the kind of summary that I think should be in a
WebProgrammingShootOut (see another one of my postings in this
thread) but I failed to find such a summary. Thanks, Brian! Anyone
can add to the list?
|
If you're just trying to get a conceptual understanding of web
programming, I suggest you start with cgi.
Next you might want to read Philip and Alex's Guide to Web Publishing:
http://philip.greenspun.com/panda/
It's out of date and the examples use Tcl and Oracle instead of
Python, but it's still a good explanation of how database-driven web
sites work. The rest (like languages frameworks) is just a matter of
picking some implementation parameters. |
|
| Back to top |
|
 |
Dan Perl *nix forums beginner
Joined: 19 Feb 2005
Posts: 32
|
Posted: Fri Feb 04, 2005 6:00 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Brian Beck" <exogen@gmail.com> wrote in message
news:ctv48p$75$1@eeyore.INS.cwru.edu...
| Quote: | From my experience, this appears to be the order from low-level to
high-level interfaces:
1. mod_python: As complex as you need it to be, since you can control
anything about the request & response process. But more up-front work and
decisions to make than CherryPy.
2. mod_python with Vampire: Directs you toward a specific publishing
framework that is similar to CherryPy.
3. CherryPy: Like Vampire but simpler and doesn't require mod_python. The
simplest blend between low-level server interface and ease-of-publishing.
4. Twisted: Seems like this is a big package to work with, not sure how
easy it makes publishing once you get started-- better that someone else
comment on this.
5. Zope: The most complex solution, doesn't necessarily make the 'easy
things easy.' But covers all fronts in terms of what a user would ever
need.
6. Zope with Plone: Adds a ton of publishing functionality. Has many ways
to extend, but none of them are fun. You'll have to learn such complex
APIs that Python will rarely help you.
|
This is exactly the kind of summary that I think should be in a
WebProgrammingShootOut (see another one of my postings in this thread) but I
failed to find such a summary. Thanks, Brian! Anyone can add to the list?
BTW, there are other people who seem to have been also confused by the wide
spectrum of choices for this problem:
http://pyre.third-bit.com/hippoblog/archives/000058.html |
|
| Back to top |
|
 |
Paul Rubin *nix forums Guru
Joined: 28 Feb 2005
Posts: 1197
|
Posted: Fri Feb 04, 2005 5:31 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Dan Perl" <danperl@rogers.com> writes:
| Quote: | Be careful of exposing that script to the internet. Spammers will
exploit it.
Do you mean publishing the script for other people to copy it or exposing
the web app so that other people may access it?
|
I mean installing the script on a server where spammers can run it and
stick you with the blame for people getting unwanted mail. There used
to be some similar perl scripts running all over the place until that
happened.
| Quote: | Don't worry anyway, I won't do either and I'm running 2 firewalls on
my PC. It would be really naive to expose the web app, wouldn't it?
|
Well, you should have some kind of user authentication if you expose
it, and you should read up a bit about security for web apps. Python
is actually not such a great language for this, but you certainly get
more readable code than you would with perl. |
|
| Back to top |
|
 |
Dan Perl *nix forums beginner
Joined: 19 Feb 2005
Posts: 32
|
Posted: Fri Feb 04, 2005 5:28 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Michele Simionato" <michele.simionato@gmail.com> wrote in message
news:1107495895.697731.183550@z14g2000cwz.googlegroups.com...
| Quote: | Dan Perl:
The application is just something I'm playing with to learn a little
bit on
web apps. It uses an HTML form to send an email. The form takes
inputs
like the From:, To: and Subject: fields and a text field.
It is difficult to beat CGI + CGIHTTPServer for conceptual simplificity
and easy of use: however, Quixote comes close and it has a *much*
better support for forms.
|
So Quixote is another framework I will have to look into. Best of all,
though, after adding Quixote to the list I decided I have enough words to do
a search. There were a few interesting finds, but one single link that
points to the best of them is:
http://www.python.org/moin/WebProgrammingShootOut |
|
| Back to top |
|
 |
Brian Beck *nix forums addict
Joined: 19 Feb 2005
Posts: 54
|
Posted: Fri Feb 04, 2005 5:18 am Post subject:
Re: advice needed for simple python web app
|
|
|
Dan Perl wrote:
| Quote: | Basically, what I'm looking for is a web server that accepts an HTTP request
and invokes a python script. But I would like a "pythonic" solution so a
web server like Apache is a solution that I would like to avoid. The server
should also be as simple as possible to administrate.
|
As M.E.Farmer suggested, CherryPy is definitely what you are looking
for. I have done a bit of shopping around and this is pretty much as
straightforward as you can get.
From my experience, this appears to be the order from low-level to
high-level interfaces:
1. mod_python: As complex as you need it to be, since you can control
anything about the request & response process. But more up-front work
and decisions to make than CherryPy.
2. mod_python with Vampire: Directs you toward a specific publishing
framework that is similar to CherryPy.
3. CherryPy: Like Vampire but simpler and doesn't require mod_python.
The simplest blend between low-level server interface and
ease-of-publishing.
4. Twisted: Seems like this is a big package to work with, not sure how
easy it makes publishing once you get started-- better that someone else
comment on this.
5. Zope: The most complex solution, doesn't necessarily make the 'easy
things easy.' But covers all fronts in terms of what a user would ever need.
6. Zope with Plone: Adds a ton of publishing functionality. Has many
ways to extend, but none of them are fun. You'll have to learn such
complex APIs that Python will rarely help you.
Of course there are more, like Webware, but you didn't mention that and
I don't have experience with it.
--
Brian Beck
Adventurer of the First Order |
|
| Back to top |
|
 |
Dan Perl *nix forums beginner
Joined: 19 Feb 2005
Posts: 32
|
Posted: Fri Feb 04, 2005 5:12 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote in message
news:7xis58c1lw.fsf@ruckus.brouhaha.com...
| Quote: | "Dan Perl" <danperl@rogers.com> writes:
The application is just something I'm playing with to learn a little bit
on
web apps. It uses an HTML form to send an email. The form takes inputs
like the From:, To: and Subject: fields and a text field.
Be careful of exposing that script to the internet. Spammers will
exploit it.
|
Do you mean publishing the script for other people to copy it or exposing
the web app so that other people may access it? Don't worry anyway, I won't
do either and I'm running 2 firewalls on my PC. It would be really naive to
expose the web app, wouldn't it? |
|
| Back to top |
|
 |
Paul Rubin *nix forums Guru
Joined: 28 Feb 2005
Posts: 1197
|
Posted: Fri Feb 04, 2005 4:53 am Post subject:
Re: advice needed for simple python web app
|
|
|
"Dan Perl" <danperl@rogers.com> writes:
| Quote: | The application is just something I'm playing with to learn a little bit on
web apps. It uses an HTML form to send an email. The form takes inputs
like the From:, To: and Subject: fields and a text field.
|
Be careful of exposing that script to the internet. Spammers will
exploit it. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|