Unable to get Python to POST on html

2019-09-14 17:03发布

I've been trying to get my python code to post. I have tried using the Postman Plugin to test the post method and I would get a 405 method error. I am planning to have the user post the information and have it displayed.

Currently if I press submit I would get a error loading page, changing the form to get results in the submit button working and returning to the previous page. If I change the handler to post the screen would instantly display '405 Method Not Allowed'. I've looked through the Google App Engine logs and there are no errors. Can someone help me with what I done wrong and advise me on how to the post method functioning? Thanks for the time.

1条回答
三岁会撩人
2楼-- · 2019-09-14 17:22

You're getting '405 method not allowed' because the POST is going to the same url that served up the page, but the handler for that path (MainPage) does not have a post method.

That's the same diagnosis that you were given when you asked this question two hours earlier under a different user id.

Stepping back further to address the "what have I done wrong" question: It seems to me that you've gotten quite far along before discovering that what you have doesn't work. So far along that the example is cluttered with irrelevant code that's unrelated to the failure. That makes it harder for you for figure this out for yourself, and it makes it more difficult for people here to help you.

In this situation, you help yourself (and help others help you) by seeing how much code you can eliminate while still demonstrating the failure.

查看更多
登录 后发表回答