HTML フォームから投稿されたデータを処理する Python Web サービスを Google App Engine で開発しようとしています。誰かが私が間違っていることを教えてもらえますか? デスクトップ \helloworld の同じディレクトリに存在するすべてのファイル。
OS: Win 7 x64 Python 2.7 Google App Engine (ローカル)
helloworld.py
import webapp2
import logging
import cgi
class MainPage(webapp2.RequestHandler):
def post(self):
self.response.headers['Content-Type'] = 'text/plain'
form = cgi.FieldStorage()
if "name" not in form:
self.response.write('Name not in form')
else:
self.response.write(form["name"].value)
app = webapp2.WSGIApplication([('/', MainPage)],debug=False)
page.html
<html>
<body>
<form action="http://localhost:8080" method="post">
Name: <input type="text" name="name"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
ブラウザー (Chrome) を使用して page.html を表示し、フィールドにテキストを入力して送信を押します。テキストがブラウザーに表示されることを期待していますが、「名前がフォームにありません」と表示されます。HTMLのフォームメソッドをgetに、python関数をdef get(self)にすれば動くのですが、postメソッドを使いたいです。説明の助けをいただければ幸いです。