Reputation: 173
I'm learning how to write web app using appengine using Python and got
405 Method Not Allowed
The method POST is not allowed for this resource.
form = """
<form method="post">
What is yor birthday?
<br>
<label> Month
<input type = "text" name = "month">
</label>
<label> Day
<input type = "text" name = "day">
</label>
<label> Year
<input type = "text" name = "year">
</label>
<br>
<br>
<input type = "submit">
</form>"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.write(form)
def post(self):
self.response.out.write("Got The Date")
app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
I have post method in my code, so what is the problem?
Upvotes: 0
Views: 383
Reputation: 24966
When I run that sample (after adding the missing import), I get a stack trace that ends with
class MainPage(webapp2.RequestHandler):
^
IndentationError: unexpected indent
Try fixing your indentation, and pay attention to what's showing up in the logs.
The error you're seeing could also be explained by inconsistent indentation (say, if the post
method was indented at the same level as the class).
Upvotes: 1