How do I serve a large file using Pylons?

Posted by Chris R on Stack Overflow See other posts from Stack Overflow or by Chris R
Published on 2010-12-23T17:38:03Z Indexed on 2010/12/23 17:53 UTC
Read the original article Hit count: 171

Filed under:
|
|
|

I am writing a Pylons-based download gateway. The gateway's client will address files by ID:

/file_gw/download/1

Internally, the file itself is accessed via HTTP from an internal file server:

http://internal-srv/path/to/file_1.content

The files may be quite large, so I want to stream the content. I store metadata about the file in a StoredFile model object:

class StoredFile(Base):
    id = Column(Integer, primary_key=True)
    name = Column(String)
    size = Column(Integer)
    content_type = Column(String)
    url = Column(String)

Given this, what's the best (ie: most architecturally-sound, performant, et al) way to write my file_gw controller?

© Stack Overflow or respective owner

Related posts about python

Related posts about web-services