동일한 문제를 해결하기 위해 this question을 템플릿으로 사용했지만 게시 할 때 문제가 있습니다.웹 이미지를 App Engine의 blobstore에 저장하려면 어떻게해야합니까?
- HTML 이미지 URL 텍스트 상자에 형태 : 나는 이러한 구성 요소를 가지고있다. 이 게시물 ...
- 핸들러, 게시 된 URL을 필요로 인코딩하고 다시 게시 할
urlfetch
를 사용 ... - 별도의 파일 업로드 처리기 실제 절약을 수행.
구성 요소 # 3은 파일 입력을 사용하면 잘 작동합니다. 그러나 나는 단지 이미지 URL에서 무엇이 필요한지 urlfetch
을 얻는 방법을 이해하지 못합니다. 내 프로세스가 시간 초과되거나 최종 처리기에서 500 응답을받습니다.
# 1
class URLMainHandler(RequestHandler):
def get(self):
return render_response('blob/upload_url.html',
upload_url=url_for('blobstore/upload/url'))
# 2
class URLUploadHandler(RequestHandler):
def post(self):
import urllib
# Get the posted image URL.
data = urllib.urlencode({'file': self.request.form.get('file')})
# Post image to blobstore by calling POST on the file upload handler.
result = urlfetch.fetch(url=blobstore.create_upload_url(url_for('blobstore/upload')),
payload=data,
method=urlfetch.POST)
return self.redirect(url_for('blobstore/url'), result.status_code)
# 3
class UploadHandler(RequestHandler, BlobstoreUploadMixin):
def post(self):
# 'file' is the name of the file upload field in the form.
upload_files = self.get_uploads('file')
blob_info = upload_files[0]
response = redirect_to('blobstore/serve', resource=blob_info.key())
# Clear the response body.
response.data = ''
return response
또 다시, this is the process I'm following. 당신의 도움을 주셔서 감사합니다!
# 2 처리기는 파일을 가져 와서 blobstore 처리기로 업로드하는 데 30 초 밖에 걸리지 않습니다. – systempuntoout