我基本上是通过XHR请求上传图片,它正在制作,但不是在开发中。
images.get_serving_url()给出的链接返回404。
链接示例:http://localhost:8080/_ah/img/LCDrjov_QuwEE7peQTeAbg==
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
upload_files = self.get_uploads('file') # 'file' is file upload field in the form
blob_info = upload_files[0]
blob_key = blob_info.key()
tmp_file = ProjectImage()
tmp_file.image_blobkey = blob_key
tmp_file.image_serve_url = images.get_serving_url(blob_key)
tmp_file.project_id = int(self.request.get('project_id'))
tmp_file.put()
self.response.out.write("success")
修改:我正在使用与Python App Engine 1.8.9搭建的Google App Engine Launcher
解决方案:
问题是找不到PIL。我从App Engine doc中提供的链接安装了32位版本。我需要64位版本,这是不容易找到的,因为它全部被枕头取代。
以下是指向它的链接:http://christianakesson.com/2013/4615
(向下滚动到帖子的末尾以获取二进制文件)