[mod_python] Sending files

Nicolas Lehuen nicolas.lehuen at gmail.com
Mon Jan 17 07:12:31 EST 2005


Hi,

I've never tried it, but have a look at the req.sendfile() method :

http://www.modpython.org/live/current/doc-html/pyapi-mprequest-meth.html

"This function provides the most efficient way to send a file to the client."

Regards,
Nicolas


On Mon, 17 Jan 2005 05:36:59 -0500, SAiello at Jentoo.com
<SAiello at jentoo.com> wrote:
> Hello All,
> 
> I was wondering if there was a better way to send file through mod_python
> than:
> 
> file=open('example.mp3', 'r')
> req.conent_type='audio/mpeg'
> req.write(file.read())
> file.close()
> 
> Just from the simple use I have done, this manner of sending files seems to be
> slow. Any suggestions ?
> 
> Thanks,
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list