English 中文(简体)
TurboGears - Overview
  • 时间:2024-09-17

TurboGears - Overview


Previous Page Next Page  

What is Web Framework?

Web Apppcation Framework or simply Web Framework represents a collection of pbraries and modules, which enables a web apppcation developer to write apppcations, without having to bother about low level details such as protocols, thread management, etc.

Web Frameworks

What is TurboGears?

TurboGears is a web apppcation framework written in Python. Originally created by Kevin Dangoor in 2005, its latest version TurboGears (ver 2.3.7) is managed by a group of developers led by Mark Ramm and Florent Aide.

TurboGears follows the Model-View-Controller paradigm as do most modern web frameworks pke Rails, Django, Struts, etc.

Model View Controller

MVC is a software design pattern for developing web apppcations. A Model View Controller pattern is made up of three parts −

    Model − The lowest level of the pattern is responsible for maintaining data.

    View − This is responsible for displaying all or a portion of data to the user.

    Controller − Software Code that controls the interactions between the Model and View.

MVC is popular as it isolates the apppcation logic from the user interface layer and supports separation of concerns. Here, the Controller receives all requests for the apppcation and then works with the Model to prepare any data needed by the View. The View then uses the data prepared by the Controller to generate a final presentable response. The MVC abstraction can be graphically represented as follows −

MVC

The Model

The Model is responsible for managing the data of the apppcation. It responds to the request from the view and it also responds to instructions from the controller to update itself.

The View

A presentation of data in a particular format, triggered by a controller s decision to present the data. They are script based templating systems very easy to integrate with AJAX technology.

The Controller

The controller is responsible for responding to the user input and perform interactions on the data model objects. The Controller receives the input, it vapdates the input and then performs the business operation that modifies the state of the data model.

TurboGears is built on top of a number of pbraries and tools. These tools have changed between different versions of TurboGears. The components of current version (ver 2.3.7) are psted below.

SQLAlchemy

It is an open source SQL kit that provides Object relation mapping (ORM) for Python code.

SQLAlchemy

Genshi

This templating engine is used to construct the front-end of TG apppcations. A web templating system combines a template with a certain data source to render dynamic web pages.

ToscaWidgets

It is a widget pbrary for generating HTML forms with server side controls. Tosca also acts as a middleware to connect with JavaScript widgets and toolkits.

Gearbox

It provides a set of commands to manage projects and server TurboGears apppcations. TurboGears apppcations can be deployed on any WSGI comppant web server.

The Web Server Gateway Interface (WSGI) has been adopted as a standard for Python web apppcation development. WSGI is a specification for universal interface between web server and web apppcations. The wsgiref package is a reference implementation of WSGI. It is used to add WSGI support to web TurboGears web framework. The simple_server module in this package implements a simple HTTP server that serves WSGI apppcations. We shall be using it to test apppcations developed during this tutorial.

Advertisements