• home
  • forum
  • my
  • kt
  • download
  • Mod_python Tutorial

    Author: 2008-08-29 07:27:10 From:

    Mod_python is an Apache module only. Mod_python version 3.x requires Apache 2.x and Python 2.2.1. For Apache 1.3 only mod_python 2.x can be used. This tutorial requires mod_python 3.1+

    Much faster than CGI

    For every requested CGI page the Python interpreter must be launched. With mod_python Apache starts one main interpreter for the main server and one subinterpreter for each virtual host and these interpreters will be reused for all requests. They will never finish until the server is shut down.

    Mod_python handlers

    Apache processes requests in phases. A handler is a function that processes a particular phase of a request. Handlers are provided by Apache and by its modules, like mod_python.

    A number of handlers are available in mod_python. Most of them are low level replacements for Apache handlers but two, Publisher and PSP, are high level and will be covered here.

    The PSP handler processes text documents with Python code embedded between tags and transform it in pure Python code, much like PHP and ASP. If you are used to these and don't wan't to learn a new web programming paradigm then PSP is your choice.

    The Publisher handler allows access to functions and variables within a module via URLs. It avoids the spagetthi coding style thus giving the code a much more application like appearance.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Development (6)
      Introduction to Python (5)
      Miscellaneous (4)
      Searching (2)
      Web Fetching (5)
      XML and Python (4)

    New

    Hot