0
votes

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.

1
It's substantially the same as the one I mentioned - tsil
405: Do you have a webapp2 post handler? Show your code? - voscausa
Sorry I removed all the code about uploading for the time being. My code were exactly like the tutorial except that inheriting from 2 handlers: class AddProductHandler(BaseHandler, blobstore_handlers.BlobstoreUploadHandler). If it can help you see the problem, I use GAE Boilerplate github.com/coto/gae-boilerplate - tsil

1 Answers

1
votes

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