pythongoogle-app-enginegoogle-cloud-platformgoogle-cloud-datastoreblobstore

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. enter image description here enter image description here

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.


Solution

  • 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.