: 여기
는
BlobInfo.all()
사용하는 방법에 대한 예입니다 "X-AppEngine에-BlobKey을 : [당신의 blob_key]"모든 것을 함께 원하는 경우 Content-Disposition 헤더가 필요합니다. 또는 이미지라면 api를 제공하는 고성능 이미지를 사용하고 URL을 생성하고 리디렉션해야합니다 .... done
업로드하려면 업로드가 안전하게 이루어지면 appengine에 대한 처리기를 작성해야합니다. blobstore (문서에 나와 있습니다)
들어오는 요청에서 BLOB 정보를 찾는 방법이 필요합니다. 요청이 병 속에 무엇처럼 보이는지 모르겠다. Blobstoreuploadhandler에는 get_uploads 메소드가 있으며 실제로 말할 수있는 한 인스턴스 메소드 일 필요가 없습니다. 그래서 여기에 webob 요청을 기대하는 일반적인 구현 예가 있습니다. 병의 경우 병 요청 오브젝트와 호환되는 유사한 내용을 작성해야합니다.
앞으로이 대답을 찾고있는 사람들을위한
def get_uploads(request, field_name=None):
"""Get uploads for this request.
Args:
field_name: Only select uploads that were sent as a specific field.
populate_post: Add the non blob fields to request.POST
Returns:
A list of BlobInfo records corresponding to each upload.
Empty list if there are no blob-info records for field_name.
stolen from the SDK since they only provide a way to get to this
crap through their crappy webapp framework
"""
if not getattr(request, "__uploads", None):
request.__uploads = {}
for key, value in request.params.items():
if isinstance(value, cgi.FieldStorage):
if 'blob-key' in value.type_options:
request.__uploads.setdefault(key, []).append(
blobstore.parse_blob_info(value))
if field_name:
try:
return list(request.__uploads[field_name])
except KeyError:
return []
else:
results = []
for uploads in request.__uploads.itervalues():
results += uploads
return results