简体   繁体   中英

jQuery File Upload - GAE deleting uploaded blobs

I am using the jQuery File Upload plugin here: http://blueimp.github.io/jQuery-File-Upload/

I'm using their Google App Engine Python implementation to handle the file upload. I am able to upload an image, and receive a serving and thumbnail URL for it. The files appear in the admin console's Blob Viewer, and the links work.

However, after some time, the image URLs start returning 404 errors. Refreshing the Blob Viewer shows 0 blobs. It appears that GAE is automatically purging or deleting the blobs.

I am only using GAE for image storage, my application runs on another server and stores the serving and thumbnail URLs. Maybe GAE is automatically deleting them because I am not saving any references to the blob keys in the datastore? If this is a feature, does anyone know how to disable it?

I am new to GAE. Is there some way to see why/when blobs are deleted from the logs?

It turns out that the main.py file defines a cleanup() function that deletes blob keys, and when the file is uploaded it defers the execution of that function on the uploaded files. I simply commented out these lines:

    #deferred.defer(
    #    cleanup,
    #    blob_keys,
    #    _countdown=EXPIRATION_TIME
    #)

And it works. I didn't see anything about this in the documentation!

Of course, if you like the functionality, you can customize how long the image stays in the blobstore by editing the EXPIRATION_TIME variable. By default, it deletes the blobs after 5 minutes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM