TurboGears (“TG” for short) is a Python web meta-framework, which takes the best Python web components available (hence “meta-framework”) and combines them into one easy-to-install, documented whole.
Homepage: http://www.turbogears.org/
The main building blocks of TurboGears are described in the following sections in high-level terms. Feel free to use these descriptions to market TG to your clients or your IT department decision makers.
Python is a dynamic, object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and you can get productive with it within a few days of first learning it. Many Python programmers report substantial productivity gains and feel the language encourages the development of better code.
Python was developed in the beginning of the 1990s and has gained substantially in popularity over the last decade and can be now regarded as the most widely used dynamic language in many realms, among others web development, scientific computing and as a scripting language embedded in other applications.
Homepage: http://python.org/
CherryPy (aka “CP”) is the underlying application server for TG. It is responsible for taking the requests from the user’s browser, parses them and turns them into calls into the Python code of the web application. Its role is similar to application servers used in other programming languages, like e.g. tomcat, JBoss, Websphere or WebLogic for Java.
CP is now more than six years old and it is has proven very fast and stable. It is being used in production by many sites, from simple ones to the most demanding web applications.
Homepage: http://www.cherrypy.org/
All web applications need to produce HTML pages for displaying the user interface in the browser and almost all modern web applications use a templating engine for this task. Genshi is a templating engine that takes a XML template and the data from a response of the web application to a user’s request and combines & renders them into a standards-compliant (X)HTML page, which is served to the user’s browser.
Because Genshi is XML-based, it ensures that the generated (X)HTML pages are always well-formed and also helps avoiding common security flaws like cross-site-scripting (XSS), which are harder to prevent in other templating systems.
Homepage: http://genshi.edgewall.org/
Almost all modern web applications use a relational database as a storage back-end and SQLAlchemy (“SA” for short) makes using such databases easier, more secure, and more reliable. It is (among other things) a so called object-relational-mapper (“ORM”), i.e. it allows to use a relational database with an object-oriented programming pattern. This provides for better structured, easier to maintain database access code and allows to keep business logic out of the database. It is similar to the “Hibernate” framework known from the Java world (but not so overly complicated).
SA supports all the main database backends on the market, like Oracle, PostgreSQL, MySQL, MSSQL, etc.
Homepage: http://sqlalchemy.org/
Setuptools is the de-facto standard Python package manager and a library for working with re-usable components and plug-ins. TG uses it for tracking dependencies, easy installation, and loading various extensions.
Homepage: http://pypi.python.org/pypi/setuptools
FormEncode is a Python library for validating and converting input values from the web, databases, or any other data sources. It is used by TurboGears to validate request data and turn it into Python objects. It is also deeply integrated with the TurboGears widgets framework.
Homepage: http://formencode.org/
Python Paste is a set of tools for using a Web Server Gateway Interface (WSGI) stack. It has many components, but TG mainly uses PasteScript to allow users to create new TurboGears projects from templates with a single command. It also includes WebTest, a unit test framework for testing web applications.
Homepage: http://pythonpaste.org/
ConfigObj is a library to handle configuration files and make it easy to access configuration settings from text files as Python objects. TG uses it as an access layer to the CherryPy configuration.
SimpleJson is a library to convert Python objects into JSON notation and vice versa. It is used by TG’s TurboJson component, which makes serving JSON from web applications just as easy as serving HTML and enables easy AJAX-style communication between the web client and TurboGears. With Python 2.6, it has been included in Python’s standard libary under the even simpler name “json”.
Many modern web applications use AJAX-features and TurboGears supports this through JSON integration and many standard JavaScript-enhanced widgets. Though you are free to use any JavaScript library with TG, it comes packages with MochiKit, a simple but powerful suite of JavaScript libraries, which - as the homepage says - “makes JavaScript suck less”, especially for Python programers.
Homepage: http://www.mochikit.com/
The Apache web server is the industry standard for web servers and drives the majority of the world’s web sites. It is a robust, commercial-grade, featureful, and freely-available source code implementation of an HTTP (Web) server.
Apache is often used as a so-called “reverse proxy” in front of the TurboGears application server, i.e. Apache is taking the requests from the user’s browser and forwards them to the TG application server, which returns the response to Apache again and Apache sends it back to the browser.
This has two main advantages:
a) HTTPS is used between the browser and the web server, i.e. the communication between the browser and the server is encrypted, so it is safe to transfer sensitive data, e.g. login passwords etc.
b) Apache can serve static documents (CSS, images, JS, etc.), which improves performance.
Homepage: http://httpd.apache.org/
PostgreSQL (“Postgres”) is a powerful, open source relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows.
Postgres is used as the database backend through SQLAlchemy by many TurboGears applications, but the database backend can often be replaced with a different one with little effort.
Homepage: http://postgresql.org/
SQLObject is a object-realtional mapper (ORM), similar to SQLAlchemy, maybe less powerfull, but easy to learn for the novice. It was the standard database access layer in earlier versions of TurboGears and is still fully supported by TG 1.1.
Homepage: http://sqlobject.org/
Kid is a XML-based template language for Python. It is the predecessor to Genshi and was the standard templating engine in earlier TurboGears versions. It is still fully supported by TG 1.1 and used internally by the widgets framework in TG 1.1.
Homepage: http://kid-templating.org/
nose is a tool to make running unit tests easier. It integrates nicely with setuptools and therefore TurboGears. New TurboGears projects come with a basic unit test suite, which can be run by nose, out of the box.
Homepage: http://somethingaboutorange.com/mrl/projects/nose/