在 python 中为 gae 设置不同的上传处理程序的最佳方法是什么?
class MainHandler(webapp.RequestHandler):
def get(self, test):
self.response.out.write(test)
upload_url = blobstore.create_upload_url('/upload')
self.response.out.write('<html><body>')
self.response.out.write('<form action="%s" method="POST" enctype="multipart/form-data">' % upload_url)
self.response.out.write("""Upload File: <input type="file" name="file"><br> <input type="submit" name="submit" value="Submit"> </form></body></html>""")
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
upload_files = self.get_uploads('file')
blob_info = upload_files[0]
self.redirect('/')
此代码工作正常,但始终在 url /upload 调用 Uploadhandler
upload_url = blobstore.create_upload_url('/another_url')
upload_url 仍然指 /upload,那么从表单 A 重定向到上传处理程序 A 以及从表单 B 重定向到上传处理程序 B 的最佳方式是什么?