Name: [011] John Montgomery
Member: 106 months
Authored: 21 videos
Description: I'm a C/C++, Java and Python programmer living in Hove, UK. ...

Introduction to Python web-programming: CGI [ID:217]

a series of video-tutorials by John Montgomery

CGI (Common Gateway Interface) is one of the simplest ways to start writing dynamic web applications. It is viewed as quite an "old" way to write web applications, but it does not require the understanding of too many different technologies. It's therefore perfect for writing small one-shot web scripts that are essentially web front-ends to shell scripts.

Despite being an "old" technology CGI is still relevant - as can be seen by it's adoption within Google's App Engine.

This series starts of with a couple of videos introducing CGI and Python's CGI module. Later episodes will show the building of a more complex application (a wiki). The later episodes will be published in April/May 2008.

Video Tutorials

1. Introduction to Python web-programming: CGI

CGI is the simplest way of writing web applications. It's quite easy to go from writing command line scripts to writing your first CGI script. This series should you how to use Python and Python's CGI module to write a simple CGI wiki application.

2. Using Python's CGIHTTPServer module to run CGI scripts

In this ShowMeDo I demonstrate how you can use Python's CGIHTTPServer module to run a simple web server that will handle CGI (wikipedia) scripts. I then proceed to create a simple Hello World Python CGI script and show it being run via a web browser.

3. Using Python's CGI module

In this ShowMeDo I cover using Python's CGI module for handling form fields. I also demonstrate the use of the cgitb module (CGI Traceback) to help make debugging script errors easier. To round it off I demonstrate how one needs to be careful with user input. In particular I show how easy it can be to accidentally allow cross-site scripting exploits.

4. Writing a Python CGI Wiki - viewing pages

In this ShowMeDo I start creating a simple wiki that stores it's wiki text on the file system. I demonstrate how you can use basic parameters to choose which page to view. At this point we have the basic code to start writing a real wiki. The next episodes will demonstrate how to use forms to let users create and edit wiki pages. We will also cover how to use regular expressions to identify wi [...]

5. Writing a Python CGI Wiki - displaying an edit form

In this episode I modify our Python CGI wiki script to display an edit form when we try to view a page that does not currently exist. I also add an edit link, so that existing pages can be edited. The common Python idiom of using a dictionary to emulate a switch/case statement is used to select between viewing and editing a page. At this stage we have something that is beginning to resemble a pr [...]

6. Writing a Python CGI Wiki - saving changes and browser redirects

In this episode we modify our Python CGI wiki script so we can save edits we make to our pages. In addition after the changes are saved we issue a browser redirect, so the user will see the new changes without having to worry about resubmitting the edit form. This episode highlights a minor drawback with the CGIHTTPServer module - it does not let us issue 302 Redirects. As this is the case we u [...]

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for John

Learning Paths

This series lies on the following learning-paths. Learning-paths are a new initiative at Showmedo, to start structuring our content better. You can find out more here.

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com