GAE Blob键超过500字节的最大长度

时间:2017-12-14 08:47:13

标签: google-app-engine google-cloud-storage app-engine-ndb google-app-engine-python

我使用blobstore.create_upload_url将文件上传到具有相当长目录名的云存储。返回的blob键超过500个字节,并导致显示如下错误。

解决方法是使用较短的目录名称。

  1. 生成小于500字节密钥的目录和文件名长度的一般指导是什么?

  2. create_upload_url是否会生成超过最大长度的密钥?

  3. context:python,GAE标准环境

    提前致谢。

    错误消息

    ValueError: Key name strings must be non-empty strings up to 500 bytes; received AMIfv94PcVablhJ0hpvUKZgaEX3w9Ysm9RLvXRogYwLU373p-DTD6kFkVCJgwfFgq1UIM-xlG2M4GwPWC5lH4XIetUGlD_JoipLmaps9XvTK_1ZnWjUrww86Y6izXLhU-boKHl4G9YxJFi1rNU-9JjJnJ_smXmGp2Aa9OHeNd8imQrxAHjT3bOEQAvoI8MQM3KBlqnh4kVgre7Lf0AQPtb0wiPI42WbyqETQ6QD--BS-ofel0XGt_picz1SN5ECpqXfPctfuE0s40Wq72rzRsSb-UPukdbVDCrdCJOb7ZRnHSGuYtHBzJJR_ilUY9uuMsCPbo4NPOScSfovo2pfcwxjfEs-oFdHLOXu8CRzwLnnzsoNKvGy3VE6mLuDbr-R7cQefybaMQSiKL4VXzEXEVLKP3Yg_1SHeqIRD5xq1pbt1yZcplpJ5jkV-5dVdgBdI9e6NbghwOXhTQQbp7JodYgcdf5bBgemrpIn2ZhMgMrYAEYEe64DeoUBuQNDpmCUVM1z5wxFzrUMSNhayJzMfebMgFJATnppusA
    
    at _ReferenceFromPairs (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/key.py:766)
    at _ConstructReference (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/key.py:673)
    at positional_wrapper (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/utils.py:160)
    at reference (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/key.py:546)
    at key_to_pb (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/model.py:682)
    at async_get (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py:1627)
    at _get_tasklet (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/context.py:344)
    at _help_tasklet_along (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py:430)
    at get (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/context.py:760)
    at _help_tasklet_along (/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py:427)
    at blob_info_async (/base/data/home/apps/b~suiqui-dev-170002/checklist:checklist-dev.406185416109946132/suiqui/file/models.py:20)
    

    更新:

    在blobstore.BlobInfo.get_async()

    中引发了异常
    @ndb.tasklet
    def blob_info_async(self):
      blobinfo = yield blobstore.BlobInfo.get_async(self.blob_key)
      raise ndb.Return(blobinfo)
    

0 个答案:

没有答案