2.4 Testing
- Make some directory that would be visible on your web site, for
example, htdocs/test.
- Add the following Apache directives, which can appear in either the
main server configuration file, or .htaccess. If you are
going to be using the .htaccess file, you will not need the
<Directory> tag below (the directory then becomes the one in
which the .htaccess file is located), and you will need to
make sure the AllowOverride directive applicable to this
directory has at least FileInfo specified. (The default is
None , which will not work.)
<Directory /some/directory/htdocs/test>
AddHandler python-program .py
PythonHandler mptest
PythonDebug On
</Directory>
(Substitute /some/directory above for something applicable to
your system, usually your Apache ServerRoot)
- At this time, if you made changes to the main configuration file, you
will need to restart Apache in order for the changes to take effect.
- Edit mptest.py file in the htdocs/test directory so
that is has the following lines (be careful when cutting and pasting
from your browser, you may end up with incorrect indentation and a
syntax error):
from mod_python import apache
def handler(req):
req.write("Hello World!")
return apache.OK
- Point your browser to the URL referring to the mptest.py; you
should see
"Hello World!" . If you didn't - refer to the
troubleshooting section next.
- If everything worked well, move on to Chapter 3,
Tutorial.
|
What is this????
|