无法让Python在HTML上进行POST [英] Unable to get Python to POST on html

查看:404
本文介绍了无法让Python在HTML上进行POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让我的Python代码发布。我曾尝试使用邮递员插件来测试post方法,我会得到一个405方法错误。我计划让用户发布信息并显示它。



目前,如果我按提交,我会收到一个错误加载页面,更改表单以获取结果提交按钮正在工作并返回到上一页。如果我更改处理程序发布屏幕会立即显示'405方法不允许'。我查看了Google App Engine日志,发现没有错误。有人可以帮我解决我做错了什么,并告诉我如何使用post方法?
感谢您的时间。

解决方案

您收到'405方法不允许',因为POST将要提供页面的URL相同,但该路径的处理程序( MainPage )没有 post 方法。



这与您在两小时前根据其他用户标识提出此问题时得到的诊断结果相同。



进一步回顾以解决我做了什么错事的问题:在我看来,在发现你有什么不起作用之前,你已经走得很远了。到目前为止,这个例子中杂乱无章的代码与失败无关。这让你很难找出自己的想法,这让人们在这里帮助你更加困难。



在这种情况下,你帮助自己(和帮助他人帮助你),看看你可以消除多少代码,同时仍然显示失败。


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.

解决方案

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.

这篇关于无法让Python在HTML上进行POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆