[mod_python] I want mod_python to execute .pyc (or .pyo) files only

apocalypznow apocalypznow at gmail.com
Thu Oct 18 03:45:00 EDT 2007


Is there a way I can cause mod_python to execute only pyc (or pyo) 
files?  I have removed the .py files after manually compiling (using 
py_compile).  The file I want to execute is listed:

-rwxr-xr-x 1 root root 374 2007-09-17 23:20 index.pyc

My httpd.conf has the following:
Alias /test2 "/var/www/mod_python/test2"
<Directory /var/www/mod_python/test2>
   AddHandler python-program .pyc
   Options -MultiViews -Indexes
   PythonHandler mod_python.publisher
   PythonPath 'sys.path'
   PythonDebug On

The index.py (which was removed) contains the following:
def index(req):
         return "Index hit."
def hello(req):
         return "Hello hit."

When I execute http://some.url/test2/hello , I get the following:
The requested URL /test2/hello was not found on this server.

I am running mod_python 3.2.8 and Python2.3.5 on Apache 2.

The reason I want to do this is to put a small obstacle to my client 
from easily seeing the source code.  I realise this can be decompiled 
but decompilation does not produce nice results to work from, hence it 
is enough of an obstacle.  I wish to protect my authoring rights through 

Can someone please help?

More information about the Mod_python mailing list