Re: mod_python / wsgi

Steven Armstrong <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On 09/06/05 05:03, Joe Topjian wrote:
> Hi,
> 
> I successfully got pyblosxom to work with the wsgi scripts found here
> (http://www.c-area.ch/code/) and here
> (http://www.amorhq.net/blogs/index.php/fumanchu/2005/08/11/wsgi_wrapper_for_mod_python)
> and you can see it in action here (http://dev.adminspotting.net).
> 
> However, when you try browsing to a subcategory
> (http://dev.adminspotting.net/linux), it just renders the front page
> again. Any clue why this is?  Is there any documentation on how to get
> a working WSGI or mod_python install of pyblosxom?
> 
> Secondly, I know this really isn't the correct list for this, but can
> anyone point to any good docs or books on both mod_python and wsgi.  I
> realize wsgi is pretty new, so there's probably not much there. The
> docs on the mod_python page are pretty weak as they really don't give
> any practical usage. The only other references I've seen have been how
> to make a "hello world" program and send you on your way.  I just
> figure if I was a little more familiar with both of these features,
> I'd be able to figure out the above problem..
> 
> Thanks!
> 

Hi Joe

When using mod_python I found that you get problems if you assing an url 
to a mod_python app for which there is also a physical directory.

Given the following setup the SCRIPT_NAME and PATH_INFO variables can be 
messed up which could leed to the symptoms you describe:

DocumentRoot /var/www/example.com/htdocs
<Location />
   SetHandler python-program
   PythonHandler some_module::some_handler
</Location>

The problem is that if /var/www/example.com/htdocs exists, apache 
doesn't know what to set as the SCRIPT_NAME and PATH_INFO.

So if you have pyblosxom living at <Location /> and try to access say 
http://www.example.com/linux, the PATH_INFO will not be /linux as you 
might expect. It'll be empty, and instead the SCRIPT_NAME will be 
/linux. Pyblosxom uses PATH_INFO to figure out which category or post to 
show but it gets an empty PATH_INFO and assumes the frontpage is requested.

I'ld first try to setup pyblosxom on an url like /blog/ until everything 
works, and then carry on setting it up as your document root.

Possibly it'll work if you just leave out the DocumentRoot directive. 
The downside of this is that you have to setup aliases for every url 
that apache should serve static content from (assign aliases _before_ 
the <Location> that points to your mod_python app).
e.g.
Alias /images  /path/to/images
Alias /css  /path/to/css
<Location />
   SetHandler python-program
   PythonHandler some_module::some_handler
</Location>

hth
cheers
Steven



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.