我刚刚在 Ubuntu 12.10 下使用 Eclipse 开始使用 GAE,当我尝试运行示例应用程序时,我遇到了一个我无法解决的错误:
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplication([('/', MainPage)], debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
我收到了这个错误:
Traceback (most recent call last):
File "/home/mordrec/workspace/helloworld/helloworld.py", line 20, in <module>
main()
File "/home/mordrec/workspace/helloworld/helloworld.py", line 17, in main
run_wsgi_app(application)
File "/opt/google_appengine/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/opt/google_appengine/google/appengine/ext/webapp/util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "/opt/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 688, in __call__
match = regexp.match(request.path)
File "/opt/google_appengine/lib/webob_1_1_1/webob/request.py", line 303, in path
urllib.quote(self.path_info, PATH_SAFE))
File "/opt/google_appengine/lib/webob_1_1_1/webob/descriptors.py", line 23, in fget
return req.environ[key]
KeyError: 'PATH_INFO'