Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming IT Technology

A Piece of CherryPy for CGI Programmers 193

An anonymous reader writes "IBM developerWorks is running an article outlining the strengths and offering some helpful advice on the Python framework 'CherryPy'. CherryPy uses the same concepts as CGI to bind a web server to a web application, but it improves performance and gains persistence across requests by handling all its requests within a single process."
This discussion has been archived. No new comments can be posted.

A Piece of CherryPy for CGI Programmers

Comments Filter:
  • You mean... (Score:5, Insightful)

    by nxtw ( 866177 ) on Sunday August 21, 2005 @08:41PM (#13368835)
    it runs a web application in a signle process, like ASP, ASP.NET, and most likely other technologies have been doing for some time?

    This is nothing special. Just another framework that doesn't really do anything unique at all...

  • Re:Obligatory (Score:2, Insightful)

    by Anonymous Coward on Sunday August 21, 2005 @08:54PM (#13368876)
    I hate to be anal about a joke, even if it doesn't really qualify as one, but shouldn't that be more like this?

    face.smile.width.units = "Miles"
    face.smile.width = 10
  • So, we now have (Score:3, Insightful)

    by TDScott ( 260197 ) on Sunday August 21, 2005 @08:57PM (#13368888)

    Regular CGI, mod_perl, mod_python, the newcomer Ruby on Rails, and now CherryPy. Granted, some webhosts [dreamhost.com] handle the first four (even Rails) without any problems, but how many do we really need?

    I suppose the answer is "as many as it takes" — whatever's easiest for some users will be utterly impenetrable to others, and it's good to have choice. But at what point does it start to become a burden to keep up with all these — either for programmers looking to keep their CVs up to date, or hosts wanting to stay current?

  • Re:You mean... (Score:3, Insightful)

    by Jerf ( 17166 ) on Sunday August 21, 2005 @08:57PM (#13368889) Journal
    With the staggering number of frameworks available, "unique" is an awfully high bar. I'm not sure a standard that eliminates all frameworks from consideration is a valuable one.
  • Re:You mean... (Score:3, Insightful)

    by spectral ( 158121 ) on Sunday August 21, 2005 @09:10PM (#13368943)
    You mean like.. fastcgi? and then you aren't tied to your language?
  • Re:You mean... (Score:3, Insightful)

    by damiangerous ( 218679 ) <1ndt7174ekq80001@sneakemail.com> on Sunday August 21, 2005 @09:41PM (#13369073)
    At no point in the article does this claim to be "unique" in any way. Quite the opposite, in fact. It acknowledges that there has been no shortage of these frameworks. The only way in which it's "unique" is that its Python. Basically, it exists simply so that people who know and enjoy Python can stick with it.
  • by melted ( 227442 ) on Sunday August 21, 2005 @09:45PM (#13369092) Homepage
    >> Python frameworks are now catching up to things like ASP and PHP

    That's wrong on so many levels. For starters, ASP (assuming you mean ASP.NET) is lightyears ahead of anything python simply because it gets compiled into machine code before it's executed and runs "closer to the iron" (and therefore blows the doors off anything interpreted). I could name five dozen other reasons why ASP.NET and similar Java based frameworks are better, but I don't want to waste time. There's google, you can find it yourself.

    Second, what this particular Python framework is really catching up with is Ruby on Rails. And quite frankly, anyone who likes the sort of thing that RoR implements should just use RoR, not imitations.
  • by Anonymous Coward on Sunday August 21, 2005 @09:46PM (#13369096)
    "Put a function called hello() in your CherryPy application, and the return value of that function is displayed in your web browser when you visit http://address/hello [address] [address] "

    And the security issue?
  • by mcc ( 14761 ) <amcclure@purdue.edu> on Sunday August 21, 2005 @10:13PM (#13369206) Homepage
    All it does is connect the Web server to your Python code with as little fuss as possible. It doesn't make decisions about what other tools to use, so you're free to pick a templating system, database mapper, or other tool on its own terms.

    This is kind of a problem though because I actually need a templating system, database mapper, and some other tools. I have some such tools in Perl, but I obviously can't take these with me into Python.

    So I am wondering. Were one to use CherryPy, what would be logical tools to build on top of it with? If I need to be able to take objects and convert them into lines in a database or HTML for display or HTML forms for editing or whatnot, what would be the logical things to plug in on top of CherryPy to provide this?
  • Wow, dude. Chill. (Score:4, Insightful)

    by jbellis ( 142590 ) <jonathan@carDEBI ... com minus distro> on Sunday August 21, 2005 @10:50PM (#13369337) Homepage
    If you're "running like 20 wiki and 5 custom web apps and a few WordPress installations" on your server then you shouldn't be intimidated by the 2 or 3 lines it takes to forward requests to the CherryPy server.

    Get a grip.
  • by jma05 ( 897351 ) on Monday August 22, 2005 @12:56AM (#13369718)
    For crying out loud, please read the article/manual. Zope and CherryPy have NOTHING in common with Rails other than they are web app frameworks using dynamic languages. They are all different frameworks addressing different needs. Zope is very complex because it addresses a very complex problem and provides a comprehensive framework. CherryPy is similar to Rails in that functions become URLs seemlessly (no messy xml, special output calls etc) but other than that it is much simpler than Rails. It is an web application server and nothing more. It does not have a templating system, no ORM, no database abstraction -- NOTHING. All it does is manage your code for the web. You choose whatever templating system you want (I chose Cheetah), whatever ORM you want (I chose SQLObject), and whatever DB access module (I chose MySQLdb). It is a simple tool that imposes no restrictions and plays well with other tools. Development in CherryPy is similar to development with mod_python although the infrastructure is completly different. Sometimes CherryPy is easier to develop with than mod_python. STOP COMPARING EVERYTHING WITH RAILS BECAUSE THAT IS ALL YOU HEAR IN THE NEWS.
  • Python frameworks are now catching up to things like ASP and PHP
    While Python web programming has some issues, "catching up" isn't really how I'd describe it. Even in the most basic of Python frameworks you get more expressive power than in ASP and PHP. You also get equivalent performance to PHP (I can't say much about ASP -- but Python is fast enough which is all that matters). In terms of expressiveness Python beats the pants off PHP, Visual Basic, C#, and Java. There's no "catching up" there at all, they were long since passed.

    But I'd certainly agree the single process thing is a red herring; it's not what makes CherryPy interesting.

  • by Anonymous Coward on Monday August 22, 2005 @04:50AM (#13370255)
    What your post boils down to is you complaining that in order to use something new, you have to learn something new.

    Well, duh.

    Anyway it's all here: CherryPy behind Apache [cherrypy.org]
  • Re:Obligatory (Score:4, Insightful)

    by Roberto ( 1777 ) on Monday August 22, 2005 @07:48AM (#13370610) Homepage
    How hard is it to try it? Not hard.

    [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a=1;b=2
    >>> a
    1
    >>> b
    2
    >>>

This file will self-destruct in five minutes.

Working...