简体   繁体   中英

google-datastore obtaining the correct blob item key for download

In the google appengine datastore, there is a BlobKey (labled as csv). The key is in the following format: encoded_gs_file:we1o5o7klkllfekomvcndhs345uh5pl31l. I would like to provide a download button to save this information.

The web app is being run using dev_appserver.py and uses python 2.7 (Django) as the backend. Currently, a button exists, but when clicking on it, it returns a 404 error. The download link that the button provides is:

https://localhost:8080/data?key=encoded_gs_file:dwndjndwamwljioihkm

The interesting thing is that, when i go to localhost:8000/datastore and then navigate to the Blobstore Viewer, i can navigate to Entity Kind: GsFileInfo , and there is a key generated. The problem is that it gives a 404. 在此处输入图片说明 在此处输入图片说明

The other blob item next to is a png and if i use the key for that png, i get a download. What is wrong with the key, how can i get the write key from the datastore.

I'm still scratching my head in regards to your issue, but something that seems suspect is that size is None and finalized is False for your CSV file.

I looked back at your previous question ( google cloud: downloading as an CSV ) and noticed that you're not calling .close() on your GCS/blobstore file after you finish writing to it.

Maybe that will fix this.

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