mod_python and css

Thomas Jollans thomas at jollans.com
Thu Jun 24 15:19:21 EDT 2010


On 06/24/2010 09:10 PM, Bradley Hintze wrote:
> Hi all,

about your question, no idea.

> 
> the mod_python mailing list is pretty dead so I thought I'd try asking
> my question here.

It comes as no surprise to me that the mod_python mailing list is dead:
nobody uses mod_python anymore. For all I know, it might be broken, and
the API was (IIRC) never particularly nice.

IMHO, you should use WSGI instead: it's an interface portable across web
server boundaries, and, with mod_wsgi, it's just as high-performance on
apache as was mod_python.

> 
> I am using mod_python and am having trouble with my .py scripts that
> output HTML. the HTML comes out alright but my style sheets are not
> being rendered. I am sure that this has to do withe a mod handler
> problem.

What does "not being rendered" mean? Do you have an exception traceback?
Can you maybe a full transcript of HTTP headers and output? (by
telnet'ing to the web server perhaps)

> 
> Here is what I have in httpd.conf:
> 
> <Directory /Library/WebServer/Documents/css>
>     AddHandler mod_python .css
>     PythonHandler handler::handler_css
>     PythonDebug On
> </Directory>
> 
> 
> Here is what handler.py looks like:
> 
> from mod_python import apache
> 
> def _dump(req, extension):
>     req.content_type = 'text/plain'
>     print >> req, 'uri = %s' % req.uri
>     print >> req, 'filename = %s' % req.filename
>     print >> req, 'path_info = %s' % req.path_info
>     print >> req, 'extension = %s' % extension
>     return apache.OK
> 
> def handler(req):
>     return _dump(req, '')
> 
> def handler_css(req):
>     return _dump(req, '.css')
> 
> 
> Any ideas on what I'm doing wrong?
> 




More information about the Python-list mailing list