CSC/ECE 517 Fall 2014/ch1a 3 zq: Difference between revisions
m (→Features) |
|||
Line 30: | Line 30: | ||
=== Logging === | === Logging === | ||
CherryPy provides the following method for application logging | |||
<pre> | |||
cherrypy.log("Hello, CherryPy!") | |||
</pre> | |||
By default, all logging is written to the console. The configuration keys <tt>log.access_file</tt> and <tt>log.error_file</tt> are also available for writing logging and errors to a text file. | |||
=== Query Strings === | === Query Strings === |
Revision as of 22:17, 13 September 2014
CherryPy Framework
CherryPy is a python based, object-oriented web framework that enables developers to quickly create lightweight and fast web applications.<ref>http://www.cherrypy.org/</ref><ref>http://en.wikipedia.org/wiki/CherryPy</ref>
Some of the popular websites using it are Hulu<ref>http://tech.hulu.com/blog/2013/03/13/python-and-hulu/</ref> and Netflix<ref>http://techblog.netflix.com/2013/03/python-at-netflix.html</ref>. The full list of applications using it can be found here.<ref>http://docs.cherrypy.org/en/latest/intro.html#websites-running-atop-cherrypy</ref>
Background
Basic Example
The following code demonstrates the most basic webserver using the CherryPy framework.
import cherrypy class WebApp(object): @cherrypy.expose def index(self): return "Hello, CherryPy!" cherrypy.quickstart(WebApp())
Run the application, and open your web browser to localhost:8080. The following page is displayed
Features
Logging
CherryPy provides the following method for application logging
cherrypy.log("Hello, CherryPy!")
By default, all logging is written to the console. The configuration keys log.access_file and log.error_file are also available for writing logging and errors to a text file.
Query Strings
Cookies
Sessions
Serve Static Content
Ajax Support
Publish REST APIs
Multiple HTTP Servers
Test Suite
References
<references/>