Skip to Content
Python® Create-Modify-Reuse
book

Python® Create-Modify-Reuse

by Jim Knowlton
July 2008
Intermediate to advanced
287 pages
4h 55m
English
Wrox
Content preview from Python® Create-Modify-Reuse

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Webmaster in a Nutshell, Second Edition

Webmaster in a Nutshell, Second Edition

Stephen Spainhour, Robert Eckstein
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9780470259320Purchase book