0

I followed this tutorial https://developers.google.com/appengine/docs/python/tools/webapp/blobstorehandlers to allow users upload image in my app. It works for my app which uses Python 2.5 environment but not for my Python 2.7 app. According to the doc, blobstore is not available in webapp2 so we have to use the webapp blobstore.

When the form is loaded, I have no error. The error appears when I submit the form.

When I put the upload_url in form action attribute and submit it, I get this error: 405 Method Not Allowed The method POST is not allowed for this resource.

When I don't put the upload_url and submit it, I have no error but the form data are not saved in the database.

4

1 回答 1

1

Could it be that you have made a mistake like

AddProductHandler(BaseHandler, blobstore_handlers.BlobstoreUploadHandler):
    def get(self):
        #Code

instead of

AddProductHandler(BaseHandler, blobstore_handlers.BlobstoreUploadHandler):
    def post(self):
        #Code

?

and if no could you try adding a def get(self) to the handler and see if it hits that one.

Another possibility is that you gave the blobstore.create_upload_url the wrong uri so that you are actually hitting the wrong handler ?

blobstore.create_upload_url(uri)

where uri should point to the AddProductHandler

于 2013-04-04T20:12:12.683 回答