[mod_python] serving files by modpython handler

Kamil Niechajewicz kamil at nvstudio.pl
Mon Feb 9 12:06:40 EST 2004


I'm using mod_python to handle all requests to, for
example, URL "mysite/". Now I need to include some
images on my website, so I put

<img src="/img/someimage.gif"> 

into my HTML and display page, but nothing happens,
because when browser wants to get an image from url
that is mapped to my modpython module it's of course
redirected to handler, and gets no image at all.

Here I want to ask, what is best way to solve this problem -
I see two ways.

- I can write some code in my handler that will check 
	whether someone wants to get a "file resource",
	and send the content of this file to browser

- Second way is making some dir outside, that will not
	be mapped to my handler, but I don't know whether it
	will work, because my _whole_ site is handled by
	mod_python module. So when I have "/ and below" 
	handled by modpython how can I have "/img" handled
	by normal apache handlers that will just send requested
	file?

What is the best method to do this?

With regards,  
 K.


More information about the Mod_python mailing list