我正在尝试通过GAE运行简单的GuestBook页面。它在其旁边显示一个文本框和一个按钮。当按下按钮时,POST方法似乎有错误。代码对我来说看起来很好,我知道这只是一个我似乎无法找到它的小错误。此资源不允许POST方法。 Google App Engine Python
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write("""<h1>Hello, world.</h1>
<br> <form action="/sign" method=post>
<textarea name=content rows=2 cols=30></textarea>
<br><input type=submit value="Sign GuestBook">
</form>""")
class GuestBook(webapp2.RequestHandler):
def post(self):
self.response.write('<h2>You wrote:</h2> %s' % self.request.get('content'))
APP = webapp2.WSGIApplication([
('/.*', MainHandler),
('/sign', GuestBook),
], debug=True)
一般来说这是一个好主意,包括在你的问题的确切的错误(与追溯),这是一个非常有用的信息。 –
确切的错误在标题中。下次我会把它也包含在问题中。 –