[mod_python] Ho do make mod_python execute more then one script in a directory ?

Gregory Trubetskoy grisha at modpython.org
Wed Jul 19 11:29:31 EST 2000


On Wed, 19 Jul 2000, Nehr, Fredrik wrote:

> With my current configuration only the generic handler of the script named
> by the "PythonHandler" directive is executed even if I point my browser at
> one of the other scripts in the same directory. How can i make mod_python
> execute the "right" script?

That's the way Apache modules work. Quoting from the tutorial:

       Some food for thought: If you were paying attention, you noticed
  that nowhere did it say that in order for all of the above to happen,
  the URL needs to refer to myscript.py. The only requirement was that it
  refers to a .py file. In fact the name of the file doesn't matter, and
  the file referred to in the URL doesn't have to exist. So, given the
  above configuration, http://myserver/mywebdir/myscript.py and
  http://myserver/mywebdir/montypython.py would give the exact same
  result.

       At this point, if you didn't understand the above paragraph, go
  back and read it again, until you do. 

> BTW: Why is argv missing from the sys module?

sys.argv is something that appears only during interactive invocation of
Python. sys.argv is created by PySys_SetArgv() C API function which is
called from main(). If python is not invoked from the command line,
main() is never executed, thus no sys.argv. This is actually one way to
tell whether you're running from the command line or embedded. 

The documentation for Py_Initialize() function mentions this, BTW.

Grisha




More information about the Mod_python mailing list