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

Configuration


While developing an application, you always need to parameterize it, so that it can be tuned as per the requirements of the hosting environment. For instance, the type of database used, PostgreSQL or MySQL, the directory in which the application resides, administrator contacts, etc.

There are different levels of configuration settings required in a web application like our photoblog:

  • Web server: Settings linked to the HTTP server

  • Engine: Settings associated with the engine hosting the application

  • Application: Settings our application will use

CherryPy—Web and Engine Configuration System

Since our application is using CherryPy, we will use the CherryPy configuration capabilities for the web server and the engine. CherryPy uses a configuration based on the syntax of the INI format defined by Microsoft.

The format of a CherryPy configuration file is as follows:

[section]
key = value

The main difference between the original INI format and the format used by CherryPy is the fact that values...