Saturday, December 27, 2014

Re: Serving mov file with Django

On 2014-12-27 08:00, Hanley Hansen wrote:
> I want to serve an mov file on the file system with Django the way
> Apache would. IBe managed to serve the file as a download but I'm
> looking to stream it so it plays in browser. I want to avoid
> setting up a alias in Apache. Though it's a static file I need to
> stream it securely based on the user. Is that possible?

It sounds like you want to investigate the "Django sendfile"

https://www.google.com/search?q=django+sendfile

which makes use of headers which tell the wrapping server (Apache,
lighttpd, nginx, etc) to send a file straight from the file-system
without needing to keep your Django app in the loop. The request hits
your Django app, you do whatever auth check you need, and if it
passes, you use sendfile in/as your response to instruct your
web-server to send the corresponding file. There's a nice write-up at

http://www.sensibledevelopment.com/2010/11/django-sendfile-an-for-abstraction-large-file-serving-in-django/

that shows how it's used. I believe it has the limitation that the
file has to come from the same server rather than a media-server, but
it does ease the load that serving directly from Django would cause.

-tkc



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20141227105558.1438565c%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment