Yes, I know way with download_handler. I want do it without my script: have
static difficult url and download direct by url - as images.

Now I select between blobstore with self download_handler and Google
Storage for developers.

2011/11/23 Jeff Schnitzer <j...@infohazard.org>

> Does this approach get the same edge caching benefit that
> image_serving_url links get?  The image links point directly at a CDN
> domain.
>
> Jeff
>
>
> On Tue, Nov 22, 2011 at 6:21 PM, Niklas Rosencrantz <nikla...@gmail.com>wrote:
>
>> Have you considered BlobstoreDownloadHandler? Using it is straighforward:
>>
>> class FileDownloadHandler(blobstore_handlers.BlobstoreDownloadHandler):
>>
>>
>>   def get(self, file_id):
>>     file_info = FileInfo.get_by_id(long(file_id))
>>
>>
>>     if not file_info or not file_info.blob:
>>       self.error(404)
>>
>>
>>       return
>>     self.send_blob(file_info.blob, save_as=True)
>>
>>
>> I use a FileInfo class and I can recommend it.
>> A good way to serve blobs I think is a FileInfo class for instance
>>
>> class FileInfo(db.Model):
>>   blob = blobstore.BlobReferenceProperty(required=True)
>>
>>
>>   uploaded_by = db.UserProperty(required=True)
>>   uploaded_at = db.DateTimeProperty(required=True, auto_now_add=True)
>>
>>
>> Then you can conveniently serve it as if it were a static file ie. /file/1001
>> along the structure file/<file.id> :
>>
>> class FileInfoHandler(BaseHandler):
>>
>>
>>   def get(self, file_id):
>>     file_info = FileInfo.get_by_id(long(file_id))
>>
>>
>>     if not file_info:
>>       self.error(404)
>>       return
>>
>>
>>     self.render_template("info.html", {
>>         'file_info': file_info,
>>
>>
>>         'logout_url': users.create_logout_url('/'),
>>     })
>>
>> You may want to look at Nick Johnson's example for implementation with
>> the blobstore
>>
>> http://blog.notdot.net/2010/03/Implementing-a-dropbox-service-with-the-Blobstore-API-Part-1
>> I think the example file serving app from Nick Johnson is good and if you
>> use python and blobstore maybe you want to follow the link.
>> My opinion is that serving and uploading files should be built into the
>> framework but it is not. Instead we have to solve the same problem
>> repeatedly: File uploads and file serving.
>>
>> Better to solve uploads and serving once and for all and the FileInfo
>> class is so little boilerplate code I can add it to most of my apps since
>> most of my apps need the functionality "add a file to the blobstore" and
>> "serve a file from the blobstore" so if you ask me I say that these
>> functions should be possible without writing your own app just as part of
>> the app server.
>>
>> Regards,
>> Niklas
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine/-/PilliI2r9eoJ.
>>
>> To post to this group, send email to google-appengine@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>
>
>
> --
> I am the 20%
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>



-- 
Blog: www.rekby.ru

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to