[mod_python] Hiding textual contents of .py script (but keeping it executable)

Byron Ellacott bje at apnic.net
Thu Sep 23 10:44:34 EDT 2004


Rich Pinder wrote:
>>   AddHandler python-program .py
>>   PythonHandler mod_python.publisher
> By your reply, you think by using this it should NOT show the text ?

Definitely not.  You're telling Apache there that .py should be handled 
as a python-program.

In $DOCUMENTROOT/foo/.htaccess, I have:

     AddHandler python-program .py
     PythonHander mod_python.publisher

In $DOCUMENTROOT/foo/foo.py, I have:

     import time
     def index(req):
         return time.asctime()

See http://mlm.bpa.nu:8080/foo/foo.py and note that the source is not 
returned, and that the return is definitely dynamically generated.

Is mod_python enabled in your web server?  Perhaps you haven't restarted 
Apache since adding those configuration directives?  Are you using 
Apache 1.3 or 2.0?  Can you get it to do anything dynamic at all?

-- 
bje


More information about the Mod_python mailing list