Re: How to return an audio file in django

2010-04-26 Thread Christophe Pettus
On Apr 26, 2010, at 11:52 AM, Dexter wrote: But my situation is this: I have a folder with my music collection, I scan the folder and record the pathnames. Because I don't want to set this folder public, I want to manage the user login with django so not everyone can download my music. Is t

Re: How to return an audio file in django

2010-04-26 Thread Dexter
X-Sendfile doesn't work (yet), Although I got the ugly way working now. When I try to download it manually, it seems to be getting an empty file. even though I have set the Content-Length value. Any suggestions? Grtz, Dexter On Mon, Apr 26, 2010 at 9:24 PM, Dexter wrote: > It doesn't seem to wo

Re: How to return an audio file in django

2010-04-26 Thread Dexter
It doesn't seem to work very good. I'll read about X-Sendfile, don't know if it suits my purpose. On Mon, Apr 26, 2010 at 8:52 PM, Dexter wrote: > I'm using both, > > I'm not familiar with X-Sendfile, > > But my situation is this: I have a folder with my music collection, I scan > the folder and

Re: How to return an audio file in django

2010-04-26 Thread Dexter
I'm using both, I'm not familiar with X-Sendfile, But my situation is this: I have a folder with my music collection, I scan the folder and record the pathnames. Because I don't want to set this folder public, I want to manage the user login with django so not everyone can download my music. Is

Re: How to return an audio file in django

2010-04-26 Thread Christophe Pettus
Another possibility, if you are using either Apache or Lighttpd, is the X-Sendfile header, so that the Python process does not have to handle the content. For lighttpd: http://blog.lighttpd.net/articles/2006/07/02/x-sendfile For Apache: http://tn123.ath.cx/mod_xsendfile/ On Apr 26, 20

Re: How to return an audio file in django

2010-04-26 Thread Nick Serra
Interesting. If the file is an mp3, maybe try: file = open("/path/to/my/song.mp3", "rb").read() response['Content-Disposition'] = 'attachment; filename=filename.mp3' return HttpResponse(file, mimetype="audio/mpeg") On Apr 26, 1:20 pm, Dexter wrote: > Hi there, > > I want to send an audio file v

How to return an audio file in django

2010-04-26 Thread Dexter
Hi there, I want to send an audio file via a django view, but I don't know how. This doesn't seem to work: return HttpResponse(open(song.path).read(), mimetype = "audio/mpeg") Can you guy's help me? Grtz, Dexter -- You received this message because you are subscribed to the Google Groups