[mod_python] Problem with .psp_

Charles Perreault muganor at videotron.ca
Fri Dec 21 00:13:47 EST 2007

Graham Dumpleton wrote:
> On 21/12/2007, Charles Perreault <muganor at videotron.ca> wrote:
>> ~$: ls -las /home/user/public_html/
>>  8 drwx--x--x  7 user user  4096 2007-12-20 21:58 .
>> 64 drwx--x--x 71 user user 49152 2007-12-20 23:01 ..
>>  8 drwx--x--x  5 user user  4096 2007-12-16 22:04 cgi-bin
>>  0 drwxr-xr-x  2 user user     1 2007-12-16 11:24 download
>>  4 -rw-r--r--  1 user user  1150 2007-11-06 20:45 favicon.ico
>>  4 -rw-r--r--  1 user user    66 2007-12-16 22:29 test.psp
>>  4 -rw-r--r--  1 user user   401 2007-12-16 00:31 index.html
>>  4 -rw-r--r--  1 user user   106 2007-12-17 16:16 komodo.html
>>  4 -rw-r--r--  1 user user   206 2007-12-16 23:57 komodo.py
>>  4 -rw-r--r--  1 user user   134 2007-12-16 23:23 mptest.py
>>  4 drwx--x--x  5 user user    72 2007-12-17 16:24 noel
>>  8 drwx--x--x 10 user user  4096 2007-12-16 01:01 photos
>>  0 drwx------  4 user user    16 2007-11-26 21:56 upload
>> Yes Apache is running as user and group 'www-data'.  I know about file
>> permissions and ACL a lot.  The complaint in error.log is about Apache
>> Multiviews, which I don't care if it doesn't work.  In fact I'm thinking
>> about disabling it.  You say Apache needs reading option on directories,
>> which from my experience is only true IF you want it to be able to
>> create a directory listing (which is a minor security issue and must be
>> enabled on a per-directory basis).
> True, although looks like MultiViews may depend on getting directory
> listing as well and thus the error.
Indeed it does need to get the directory listing.  Multiview tries to 
match inexisting requests with the best match it can find in a 
directory.  Therefore, it needs to get the listing and parse it.  
Example:  http://localhost/mypage  may be redirected to 
http://localhost/mypage.php if mypage don't exist.  However, if  
mypage.xhtml, mypage.html, mypage.html3, mypage.psp, mypage.php all 
exists, it's hard to know which file will be picked.
>>  Else, indeed files need reading
>> permissions and folders only need execute.  Does mod_python .psp_
>> debugging rely on Multiview and therefore on folder reading permissions ???
> No, doesn't require MultiViews so safe to disable that option. Can't
> see how it would make a difference though.
Same here.
> Can't think of anything else at the moment and don't have access to
> mod_python code to look at it.
Maybe multiview can make .psp_ work, since it will try to match the 
request with an existing file, which will surely be the .psp file.  But 
I doubt that is the correct way to make .psp_ work.
> BTW, as far as teaching a class, any reason why you didn't go for web
> stuff that works to WSGI interface rather than mod_python? WSGI is the
> way Python is heading and way more hosting options available for it.
Most of my material is already prepared (notes, assignments, etc) and 
translated in French (Université de Sherbrooke, Québec, Canada).  Of 
course Django, WSGI, ASP.NET, Ruby on rails, are all very fun to learn 
and use, but a choice must be made.  I'm going to teach web programming 
to a class of geo-scientists, not programmers.  They don't even know 
for-loops and html... So, we must start from the bottom (html) and go 
up.  In a 15 weeks semester, there isn't enough time to teach html, 
javascript, css, python, cgi, parallel computing, distributed systems, 
wsgi and django, and plone, and etc.  mod_python fills the gap between 
cgi and frameworks, and is similar to php/asp, which is very common 
nonetheless.  Python is easier to learn than php, IMHO.  Students will 
learn the basis, and from there continue with real world tools if they 
need too.  The philosophy here is to learn people how things work, under 
the hood, and become versatile.  Then, the use of higher level 
frameworks and real life tools is somewhat easier, and will be done if 
the students need to in their future job.

>> Graham Dumpleton wrote:
>>> What do you get if you run:
>>>   ls -las /home/user/public_html/
>>> Apache complaining about directory permissions is pretty significant.
>>> Because Apache is running as a special user, it must have read/search
>>> access to that directory plus the parent user directory.
>>> It is odd though that you would get this complaint if straight .psp
>>> file is working.
>>> Graham
>>> On 21/12/2007, Charles Perreault <muganor at videotron.ca> wrote:
>>>> The Apache access/error log don't say much :
>>>> access.log :
>>>> - - [20/Dec/2007:21:59:48 -0500] "GET /~user/test.psp_
>>>> HTTP/1.1" 403 326 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US;
>>>> rv: Gecko/20071128 Ubuntu/8.04 (hardy) Firefox/"
>>>> error.log :
>>>> [Thu Dec 20 21:59:48 2007] [error] [client] (13)Permission
>>>> denied: cannot read directory for multi: /home/user/public_html/
>>>> The same lines are repeated for each access to test.psp_.
>>>> Thank you,
>>>> Charles
>>>> Graham Dumpleton wrote:
>>>>> In the Apache access/error log, what is it saying when trying to
>>>>> access the .psp_ file?
>>>>> There should be an indication as to what Apache has matched the URL to
>>>>> in the file system. With that can tell why configuration may not be
>>>>> working.
>>>>> Graham
>>>>> On 21/12/2007, Charles Perreault <muganor at videotron.ca> wrote:
>>>>>>  Hello,
>>>>>>  I'm teaching a class on web applications and I want my students to use
>>>>>> mod_python.  They'll have a couple of assignments during the semester, all
>>>>>> to be done in python cgi (first assignment, just to get started) and psp.
>>>>>> I'm now setuping Apache on our Ubuntu 7.10 server (Apache/2.2.4 (Ubuntu)
>>>>>> mod_python/3.3.1 Python/2.5.1 Server).  All configuration have to be done on
>>>>>> server / virtual host config, forget the .htaccess (way to much trouble for
>>>>>> students).
>>>>>>  My students will program their sites in their home folder (~/public_html).
>>>>>> I want them to be able to both use mod_python.psp and mod_python.publisher,
>>>>>> as I'll show them to use the both methods to create web applications.  So
>>>>>> far, I've easily been able to make both work in the same directory using the
>>>>>> following configuration (on Debian/Ubuntu httpd.conf is splitted in multiple
>>>>>> files, allowing to enable/disable modules easily) :
>>>>>>  userdir.conf
>>>>>>  ----------------------
>>>>>>  <IfModule mod_userdir.c>
>>>>>>         UserDir public_html
>>>>>>         UserDir disabled root
>>>>>>         <Directory /home/*/public_html>
>>>>>>                 AllowOverride FileInfo AuthConfig Limit
>>>>>>                 Options MultiViews Indexes SymLinksIfOwnerMatch
>>>>>> IncludesNoExec
>>>>>>                 AddHandler mod_python .py .psp .psp_
>>>>>>                 PythonHandler mod_python.psp | .psp .psp_
>>>>>>                 PythonHandler mod_python.publisher | .py
>>>>>>                 PythonDebug On
>>>>>>         </Directory>
>>>>>>  </IfModule>
>>>>>>  So you see I'm trying to assign .psp and .psp_ to mod_python.psp and .py to
>>>>>> publisher.  So http://localhost/~user/test.py and
>>>>>> http://localhost/~user/test.psp both work.  However, psp debugging with the
>>>>>> underscore trick (.psp_) don't work.  I get a 403 forbidden error when I try
>>>>>> to access http://localhost/~user/test.psp_.
>>>>>>  Of course, test.psp exists.  From what I read, test.psp_ don't need to
>>>>>> exist because the psp handler will understand that a debug request was done.
>>>>>>  But it's not working.  However, if I create a symbolic link to test.psp :
>>>>>>  ln -s test.psp test.psp_
>>>>>>  the debug request works.  I get to see the generated PSP-produced python
>>>>>> code and psp-html source.
>>>>>>  I must be missing something.  Is there an Apache configuration that could
>>>>>> be enabled by default that would prevent me to access .psp_ files that don't
>>>>>> exist, before the mod_python.psp handler could do its magic ?
>>>>>>  Anyone please can help ?  Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20071221/bd1d5ecf/attachment-0001.html

More information about the Mod_python mailing list