Python development masterclass
It may seem like Python is just another scripting language, but know that when you are using Linux, the chances are there is some Python code working backstage helping you. Among other things, this article looks into the versatile nature of Python and its many uses…
Web application development
Python has strong support for both ends of the web, ie server side and client side. Let’s look at some of the important web offerings created in Python:
TurboGears 2: TurboGears is a Python web application framework consisting of several WSGI components such as Pylons, SQLAlchemy, Genshi and Repoze.
Django: Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Django has already been covered in this magazine – please see issue 86 of Linux User & Developer to read more about Django and how to use it to develop apps. There are also various client-side frameworks available in Python which we will cover in the coming issues.
TurboGears 2 is built around various WSGI (Web Server Gateway Interface) components. WSGI is a Python technology which defines a simple and universal interface between web servers and web applications or frameworks for the Python programming language. Together, these WSGI components form an MVC (model-view-controller) compatible architecture. TurboGears 2 uses the following WSGI components:
SQLAlchemy (model): SQLAlchemy is an open source SQL toolkit and object-relational mapper for the Python programming language, released under the MIT License. In TurboGears 2 it handles the table structures of the user’s database and enables the linking of them to Python objects that the user’s controller can interact with.
Genshi (view): Genshi acts as the template engine for TurboGears 2. It uses XML-based vocabularies written in Python. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents.
Pylons (controller): Pylons is a WSGI-compliant web framework. In TurboGears 2 it acts as the brain of the framework. It handles all of the user’s back-end logic and connects to the user’s web server to offer up data to the web.
Repoze: This was originally conceived as an effort to bring WSGI to the Zope framework. Under TurboGears 2, Repoze looks after the security of web applications. Its specific modules, Repoze.who and Repoze.what, are used to handle authentication and authorization respectively.
Tosca Widgets: ToscaWidgets is a framework for building reusable web components. It is the primary widget library for creating forms and complex GUIs. Tosca by default will generate simple HTML forms, but can also be used as middleware to connect to more advanced JavaScript widgets and toolkits.
Click here for more tutorials from Linux User & Developer magazine.















Please state which old python version and other programs you are using. It is obvious from your print statements that it is not 3.1.2 which is recommended for ALL new development.
@Frank Python 3.1.2 is not recommended for development as of now. If you had read the article completely you would have known that Python currently maintains two mutually incompatible branch of the 2.X and 3.X. Until 3.X is finalized 2.X will remain in the usage. FYI: 2.X is still used in 95% of the installed applications.