From: James Gessling [jgessling@YAHOO.COM] Sent: Friday, November 03, 2000 12:06 PM To: Info-VAX@Mvb.Saic.Com Subject: Announce: mod_python plug in for CSWS (apache) Not sure how many of you are taking of advantage of the python scripting language ported to VMS by Uwe Zessin, but I find it quite useful. Now that Compaq has released, and is supporting the CSWS (apache) web server it seemed like a good idea to be able to write CGI scripts in Python. In the Apache world you do that by creating a loadable module. (Compaq supplies one for Perl, mod_perl). With the help of Compaq support, yes you can call colorado and ask apache questions, it really is supported, I built a module for python using Uwe's code ( http://decus.decus.de/~zessin/python ) and mod_python code from www.modpython.org and CSWS from www.openvms.compaq.com/openvms/products/ips/apache/csws.html . Detailed instructions follow, sorry it's kind of long. lots of little steps. These instructions will be available as readme.vms at modpython.org too. Jim How to build and install mod_python on a VMS system This assumes apache and python already installed successfully. I tested Compaq's CSWS version of Apache. Python was 1.5.2 from decus.decus.de/~zessin/python. 0) download current release (wrote this for 2.6.3) from www.modpython.org. 1) create directories on a VMS system something like: dka0:[mod_python.src.include] 2) put the .c files in src, the .h in include 3) Cut the script off the end of this file, save it in the src directory. Edit as necessary and use it to compile and link mod_python.exe. Sorry, I didn't make much effort to make it very sophisticated. 4) Under your python lib directory, add a subdirectory [.mod_python]. For example: dka100:[python.python-1_5_2.lib] 5) Populate this subdirectory with mod_python .py files. This allows for module importing like: import mod_python.apache which will find apache.py 5) Edit apache$root:[conf]httpd.conf to add line: Include /apache$root/conf/mod_python.conf (typically at the end of the file) 6) create apache$root:[conf]mod_python.conf containing: ############################################################################ ## # Mod_Python config ############################################################################ ## # # Load the dynamic MOD_PYTHON module # note pythonpath must be in python list literal format # LoadModule PYTHON_MODULE modules/mod_python.exe AddHandler python-program .py PythonHandler mptest PythonDebug On PythonPath "['/dka100/python/python-1_5_2/lib','/dka100/python/python-1_5_2/ vms/tools','/apache$root/htdocs/python']" # 7) put mod_python.exe into apache$common:[modules] so it can be found and loaded. (create the directory if required). 8) fire up the web server with @sys$startup:apache$startup 9) Create a file mptest.py in a python subdirectory of your document root, Typically apache$common:[htdocs.python]. Like this: from mod_python import apache def handler(req): req.send_http_header() req.write("Hello World!") return apache.OK ( watch your indenting, as usual ) 10) point browser to: http://node.place.com/python/mptest.py 10) enjoy "hello world" $! build script, edit as needed to match the directories where your $! files are located. Note /nowarning on cc, this is $! required because of a #define clash between apache $! and python. If not used, the .exe is marked as $! having compilation warnings and won't load. Apache $! should already have been started to create apache$httpd_shr $! logical name, Running the apache server with the -X flag $! as an interactive process can be used for debugging if $! necessary. $ set noon $ library/create mod_python_lib $ cc :== cc /nowarning/prefix=all/include=(dka100:[python.python-1_5_2],- dka100:[python.python-1_5_2.include],- dka0:[],- dka200:[apache.apache.src.include],- dka200:[apache.apache.src.os.openvms]) $ cc _apachemodule $ library/insert mod_python_lib _apachemodule $ cc connobject $ library/insert mod_python_lib connobject $ cc mod_python $ cc requestobject $ library/insert mod_python_lib requestobject $ cc serverobject $ library/insert mod_python_lib serverobject $ cc tableobject $ library/insert mod_python_lib tableobject $ cc util $ library/insert mod_python_lib util $! mod_python $ link/share/sysexe mod_python,sys$input/opt SYMBOL_VECTOR=(PYTHON_MODULE=DATA) mod_python_lib/lib apache$httpd_shr/share dka100:[python.python-1_5_2.vms.o_alpha]python_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]modules_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]vms_macro_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]objects_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]parser_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]vms_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]modules_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]vms_macro_d00/lib dka100:[python.python-1_5_2.vms.o_alpha]vms_d00/lib case_sensitive=no $! $ exit