【发布时间】:2014-03-11 22:36:15
【问题描述】:
我正在学习 Udacity 网络编程教程 (https://www.udacity.com/wiki/cs253/unit_2#submitting-input)。
在 Google App Engine 中,我们有一个名为 main.py 的文件。
这是一个非常基本的“main.py”的代码
import webapp2
form = """
<form action="http://www.google.com/search">
<input name="q">
<input type="submit">
</form>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
#self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write(form)
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
我查看了 webapp2 源代码 (https://code.google.com/p/webapp-improved/source/browse/webapp2.py),发现 RequestHandler 类中的 get() 方法没有定义。
源代码中的什么地方说必须定义处理程序的 get(self) 方法?我知道我无法理解 GAE 的所有细节,但很高兴看到它在哪里指定。
【问题讨论】:
标签: python django google-app-engine