[mod_python] Possible partial answer to Windows config problems

Lee Brown administrator at leebrown.org
Mon Jun 19 12:00:32 EDT 2006


Greetings!
 
Just to clear up an ambiguity and to augment what Ian and Graham wrote:
 
Yes, both the Directory directive and the Alias directive must be absolute
Windows paths including a drive letter.  However, they must be a subpath of
of DocumentRoot (which is not necessarily a subpath of Apache root) OR they
must be aliased into the document root with the Alias directive.  For
example, given an Apache server installed at "C:/Program Files/Apache
Group/Apache2" and a web site located at "C:\webdev\sites\crashtest" the
following Directory directives are valid for the following VirtualHost
snippet:
 
<VirtualHost *:80>
 
    ServerName "crashtest.leebrown.org"
    DocumentRoot "C:/webdev/sites/crashtest/content"
        AddHandler mod_python .py
 
    <Directory "C:/webdev/sites/crashtest/content">
        PythonHandler content_handler
    </Directory>
 
    Alias /error "C:/webdev/sites/crashtest/error"
 
    <Directory "C:/webdev/sites/crashtest/error">
        PythonHandler error_handler
    </Directory>
 
</VirtualHost>
 
(Now one would think that after declaring "/error" as an Alias you could
then refer to "/error" in the Directory directive, but Noooooooo.......)
 
I prefer to set things up in the Vhost instead of using htaccess files, but
I'm just weird like that.

Best Regards,
Lee E. Brown
(administrator at leebrown.org)


 

  _____  

From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of Graham Dumpleton
Sent: Saturday, June 17, 2006 7:48 PM
To: ian McDowall
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Possible partial answer to Windows config problems



On 18/06/2006, at 7:06 AM, ian McDowall wrote:


There have been questions from Karl Kobata and John Cartwright and I may
have a partial answer.

In particular, one of the problems that I spent a little time over was the
use of the Apache <Directory> tag to control mod_python configuration.

The example in the mod_python tutorial is slightly ambiguous, particularly
as it is written from a Unix / Linux perspective. I suspect that this is
bog-standard Apache configuration rather than anything peculiar to
mod_python but I guess that people are coming fairly new to both at the same
time (as was I).

The directory in the <Directory> tag has to be an absolute Windows directory
that should include a drive letter. This will have to map to a directory
under the Apache root directory. I was expecting the reference to be
relative to the Apache root directory.

For example, suppose that you have an Apache configuration with the Apache
root set to E:\ApacheRoot and you have a sub-directory testdir in which you
have placed mod_python sources. Then you can refer to URIs in this directory
from the browser as http://yourdomain/testdir/test.py if you have a set of
Apache directives such as the folliowing
<Directory "E:\ApacheRoot\testdir"> 

AddHandler mod_python .py

PythonHandler mptest

PythonDebug On 

</Directory>

In this case, my confusion was to assume that I would have a tag as follows:
<Directory "/testdir"> 
...

BTW, if you are really struggling with set-up, I got some initial progress
by omitting the <Directory> tag and just having the AddHandler etc. at the
root level. Of course, this is not wise for a real implementaton but, if you
are trying to find out if your mod_python installation is OK then it gave me
some information. of course, I had to put the .py file in the Python Lib
directory in the installation so it could be imported but that did get me
some basics working.

I hope that this helps. if it is misleading or irrelevant then please ignore
it and accept my apologies.



The best way to avoid the confusion is not to set it up in the main Apache
configuration
file but do it in a specific directory within a .htaccess file. That way the
whole issue of
how to set Directory directive goes away. Where mod_python is already
installed and
you just want to start playing, it also avoids the whole issue of pestering
some administrator
to fiddle with the main Apache configuration unnecessarily. This is why the
instructions
I post a reference to occasionally use a .htaccess file. It is generally
easier to get going
and shows more problems in setup more quickly and more easily.

Those alternate instructions again are:

http://www.dscpl.com.au/articles/modpython-001.html

Graham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060619/8976f6ba/attachment.html


More information about the Mod_python mailing list