Re: sending large downloads

2008-06-25 Thread John Hensley

If it doesn't require authorization (seems unlikely here), would a  
simple redirect to the tar file work?

If it does, look into X-Sendfile if you're using Apache (you need  
mod_xsendfile) or lighty, or X-Accel-Redirect under nginx. You do only  
what you need to in the Django view and hand off the actual delivery  
to the web server. There've been several threads covering it in this  
group.

On Jun 23, 2008, at 8:43 PM, Michael P. Soulier wrote:
> So perhaps a feature request is needed then? A simple way to hijack  
> the
> response to have full control over said response would be  
> sufficient. We
> certainly can't assume that putting all responses through the entire
> Django stack is always desirable. Sometimes you just need more  
> flexibility.
>
> I suppose that piece of code could be a simple Python CGI, but  
> having to
> break out of the framework indicates a deficiency there.
>
> I wonder if I could pull this off with a custom HttpResponse subclass.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sending large downloads

2008-06-23 Thread Michael P. Soulier
Russell Keith-Magee wrote:
> Apologies for the misdirection.

So perhaps a feature request is needed then? A simple way to hijack the
response to have full control over said response would be sufficient. We
certainly can't assume that putting all responses through the entire
Django stack is always desirable. Sometimes you just need more flexibility.

I suppose that piece of code could be a simple Python CGI, but having to
break out of the framework indicates a deficiency there.

I wonder if I could pull this off with a custom HttpResponse subclass.

Mike
-- 
Michael P. Soulier <[EMAIL PROTECTED]>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein



signature.asc
Description: OpenPGP digital signature


Re: sending large downloads

2008-06-23 Thread Russell Keith-Magee

On Tue, Jun 24, 2008 at 6:46 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Russell, #2070 refers to uploads, not downloads.

Bah! You are correct.

That's what happens when I try to answer email before my morning coffee. :-)

Apologies for the misdirection.

Russ %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sending large downloads

2008-06-23 Thread [EMAIL PROTECTED]

Russell, #2070 refers to uploads, not downloads.

On Jun 23, 5:38 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Tue, Jun 24, 2008 at 1:42 AM, msoulier <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I saw some posts on this but not many useful responses. Apologies if
> > there's already a known solution.
>
> > For a web-based backup, I need to send a large file, basically the
> > output of a tar process, to the browser. We have legacy Perl code
> > doing this now but I'd like to use Django. Is there a way to stream
> > this without reading the entire file into memory and writing it into
> > the HttpResponse object?
>
> This is an open ticket: #2070. This ticket has a patch which has been
> in development for a while. I can't comment on the current readiness
> of the patch, but the feature is listed as an optional feature for
> v1.0.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sending large downloads

2008-06-23 Thread Russell Keith-Magee

On Tue, Jun 24, 2008 at 1:42 AM, msoulier <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I saw some posts on this but not many useful responses. Apologies if
> there's already a known solution.
>
> For a web-based backup, I need to send a large file, basically the
> output of a tar process, to the browser. We have legacy Perl code
> doing this now but I'd like to use Django. Is there a way to stream
> this without reading the entire file into memory and writing it into
> the HttpResponse object?

This is an open ticket: #2070. This ticket has a patch which has been
in development for a while. I can't comment on the current readiness
of the patch, but the feature is listed as an optional feature for
v1.0.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sending large downloads

2008-06-23 Thread msoulier

Hello,

I saw some posts on this but not many useful responses. Apologies if
there's already a known solution.

For a web-based backup, I need to send a large file, basically the
output of a tar process, to the browser. We have legacy Perl code
doing this now but I'd like to use Django. Is there a way to stream
this without reading the entire file into memory and writing it into
the HttpResponse object?

Or am I operating under a bad assumption? I see now that the docs show
a flush() method. Could I say, read 1024 bytes at a time, write() them
and flush() them without consuming large amounts of memory?

Thanks,
Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---