3-5 July 2006
CERN, Geneva
Europe/Zurich timezone

Developing Applications with the Web Server Gateway Interface

3 Jul 2006, 10:10
40-S2-B01 (CERN, Geneva)


CERN, Geneva

Web Frameworks Web Frameworks


Mr James Gardner (3aims.com)


The Web Server Gateway Interface is a standard interface between web servers and Python web applications or frameworks, to promote web application portability across a variety of web servers. Although the specification has been around since 2003 there is still a broad lack of understanding in the Python web community about the WSGI and why it is so useful. This hands-on talk will give people new to PEP 333 all the skills they need to start writing their own WSGI applications along with a knowledge of current best practice and a brief overview of the WSGI components that are already available in projects like Paste (www.pythonpaste.org).


The session will begin with a description of the Web Server Gateway Interface from
the HTTP level up. The talk will demonstrate how to turn a simple "Hello World!" CGI
application into a WSGI application and progress with an explanation of how to write
WSGI middleware to add functionality to an application or to alter the response.
There will be a brief demonstration of the different ways of writing WSGI
applications and middleware as functions or classes, with or without the use of
generators and how to correctly use error handling middleware.

Once the audience is happy with the basics of the WSGI the session will move on to a
tour of some of the existing middleware components in packages such as Paste and
Pylons to demonstrate one of the key advantages of the WSGI: that developers can
re-use other people's code rather than having to start from scratch with each
different type of application they create. There will be a screencast of Paste's
AJAX-based interactive web-based debugger in action and a demonstration of how to
integrate it into existing projects.

The second stage of the session will be a workshop where the audience are encouraged
to download some specially prepared code and use it, together with their knowledge
from the first part of the session to develop a real application with a simple sign
in system. Once everyone has made an attempt we will deploy a working version to a
live Apache server using FastCGI to demonstrate that WSGI applications are suitable
for use in production environments and can be deployed with very few modifications.

Primary author

Mr James Gardner (3aims.com)

Presentation Materials