Chapter 5. Customer Follow-Up System

All the applications examined thus far have involved a character-based user interface, based on characters viewed and typed in a terminal. In this chapter, you will explore using mod_python, an add-on module for the popular open-source Apache web server, to use Python to interact with client users through a web browser.

The Customer Follow-up application will perform two main functions:

  • It will use the mod_python Apache module to present an HTML form to a client user, and enable users to type in their information (including comments) and submit it.

  • It will use the Python smtplib module to connect to an SMTP mail server and send an e-mail message to a predefined "webmaster" e-mail address.

  • For each comment submitted, it will enter a log entry to a csv file stored on the web server machine. This log can then be queried and sorted like any other spreadsheet file.

Using the Program

There are basically two user interfaces to the program: the web page that enables a comment to be entered and e-mailed, and the log file, which can be viewed with any spreadsheet (for the screen shots in this chapter, I used the OpenOffice.org Calc program).

Preliminaries

Before you can use the application, an Apache web server needs to be running, on which mod_python is installed and configured. mod_python has several different handlers, and in the example for this chapter the Publisher handler is used.

Get Python® Create-Modify-Reuse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.