how can i return a image in mod python ?

Arnaud Delobelle arnodel at
Sun Nov 18 09:27:34 CET 2007

On Nov 18, 6:46 am, Abandoned <best... at> wrote:
> Hi..
> I want to show the pictures with mod python directly.
> def showimage(req):
>     some process...
>     open /var/www/a.jpg and print
> for example if i open:
> It must show me image directly (no redirect or html)
> How can i do it ?
> I'm sorry for my bad english.
> Kind Regards....

How about:

def showimage(req):
    req.content_type="image/jpeg" # Change to you image type
    return apache.OK


BTW mod_python has its own list :)


More information about the Python-list mailing list