ID #1319

How can I use Python scripts?

Provided use of python scripts is included in your shared host package you can use them as follows:

(To test it you can use the following python script, named "mptest.py")

=============================================
from mod_python import apache

def handler(req):
    req.content_type = "text/plain"
    req.send_http_header()
    req.write("Hello World!")
    return apache.OK
=============================================

 

You will possibly have to enter the following into the .htaccess:
=============================================
PythonHandler mptest
=============================================

If needed:
=============================================
PythonDebug On
=============================================

 

The handler for the .py file ending has already been set.

Now call up the appropriate URL specify mptest.py as filename, the text "Hello World!" should appear.

 

More information about MODPython can be found on the project page:
http://www.modpython.org 

Tags: modpython, mod_python, py, python

Verwandte Artikel:

Kommentieren nicht möglich