# CherryPy: Going to and from the web has never been so easy!

# CherryPy in-an-instant

### Home page

cherrypy.org

### Fearless Leader

Remi Delon

### Claim-to-fame

Write code for the web through standard Python objects!

### What's so great?

Every URL just points to a method on an object. CherryPy looks at the URL, finds the right object for you and turns query parameters and POST data into parameters for the method it finds! It's also got a great filter system that lets you run code before and after methods are called.

When you start using CherryPy, you're not going to miss CGI, Java Servlets, or whatever it is you were doing before at all. CherryPy makes hooking code up to the web as easy as writing methods in Python. You just set an object as CherryPy's root object, and all of your URLs cleanly map to a method inside of that root object. Don't believe me? Look at Hello World:

<![CDATA[ import cherrypy class MyRoot: @cherrypy.expose() def index(self, who="World"): return "Hello, %s!" % (who) ]]>

Pointing your browser at http://yourserver/?who=Foobar, you'll see "Hello, Foobar!" in your browser. It's that easy! CherryPy automatically calls the "index" method for objects that you hook up to your root, and any method that you expose becomes automatically available as well! CherryPy also lets you define a "default" method that picks up any request which didn't match one of the methods you had defined. The default method makes it easy to do blog-like URLs: 2005/09/16/cherrypy_rocks.

And, did you notice that MyRoot doesn't subclass any other class? CherryPy leaves you free to set up your objects however it makes sense to do so!

CherryPy also gives you sessions, "filters" that can change data at various points of the request cycle, and a built-in zippy webserver.

CherryPy is a very natural and fun way to write webapps in Python.

Return to About TurboGears.