Book Image

CherryPy Essentials: Rapid Python Web Application Development

By : Sylvain Hellegouarch
Book Image

CherryPy Essentials: Rapid Python Web Application Development

By: Sylvain Hellegouarch

Overview of this book

<p>CherryPy is a Python library for web development that allows developers to build web applications in the same way as any other object-oriented Python program. Enriched by several years of active development, it has become one of the most established toolkits for building solid and high-performance web applications in Python. CherryPy abstracts the complex low-level HTTP protocol into an easy-to-use interface that respects Python idioms. The library aims at being simple to learn for a beginner while offering the most advanced features to fluent Python developers. For these reasons CherryPy was chosen to be at the heart of the popular and feature-rich TurboGears web framework. CherryPy-powered web applications are stand-alone Python applications with their own embedded multi-threaded web server, but can also run behind Apache or IIS for scalability.</p>
Table of Contents (17 chapters)
CherryPy Essentials
Credits
About the Author
Acknowledgement
About the Reviewers
Preface
Index

WSGI Support


Web Server Gateway Interface (WSGI) is defined in a Python Enhancement Proposal (PEP-333) written by Phillip J. Eby to provide a loosely-coupled bridge between the web server and web applications.

WSGI defines the following three components:

  • Server or gateway

  • Middleware

  • Application or framework

The following figure shows WSGI along with its layers:

The goal of WSGI is to allow components to be plugged and played at will, with the minimum API overhead possible. This allows code reuse of common functionalities such as session, authentication, URL dispatching, logging, etc. In fact, because the API is minimal and unobtrusive, frameworks or libraries supporting the WSGI specification will be able to handle these components.

Until CherryPy 3.0, the support of WSGI within CherryPy was not welcome due to the internal design of CherryPy and also the belief that WSGI would not necessarily make the product a better one. When Robert Brewer undertook the refactoring of the project, he improved...