Notes originally created by Enrique Vaamonde [email protected]
Your mileage may vary with these instructions
You need to have the following packages properly installed and configured in your system:
You need to download both the mod_python.dll and the mod_python-x.tgz (where x is the version number) files from the main page. Once you have all the things above mentioned we're good to go.
C:\temp
):
C:\temp\mod_python-x
).
C:\Program Files\Python\lib
).
C:\Program Files\Python\lib\mod_python-x\lib\mod_python
) to the
C:\Program Files\Python\lib\mod_python
folder. It's safe to delete
these folders we just emptied.
Once the distribution file is correctly extracted and later moved into the Python directory, it's time to modify your Apache configuration (httpd.conf) and integrate the server with mod_python. These are a few steps we must do first:
C:\Program Files\Apache Group\Apache\modules
).
C:\Program Files\Apache Group\Apache\conf\
) and edit the httpd.conf file.
Add the following line in the section "Dynamic Shared Object (DSO) Support" of the httpd.conf file:
LoadModule python_module modules/mod_python.dll
<Directory "<Your Document Root>/python"> AddHandler python-program .py PythonHandler mptest PythonDebug on </Directory>
NOTE: Replace the <Your Document Root> above with the Document Root you specified on the DocumentRoot directive in the Apache's httpd.conf file.
from mod_python import apache def handler(req): req.content_type = "text/plain" req.send_http_header() req.write("Hello World!") return apache.OK
That's it, you're ready to roll!! If you don't see the "Hello World!" message, the next section is for you.