KeyError:当使用Pydev和Google App Engin时:“PATH_INFO”

2024-04-26 22:05:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚开始在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()

我有个错误:

^{pr2}$

Tags: runfromimportselfappwsgimainresponse
1条回答
网友
1楼 · 发布于 2024-04-26 22:05:47

一两个小时前我也面临同样的问题(但在mac上)。下面的步骤5(“在本地部署”)对我很有用。在

您可以或多或少地按照这些相同的说明来进行调试(只需执行“Debug As”)。在

http://www.mkyong.com/google-app-engine/google-app-engine-python-hello-world-example-using-eclipse/

要在本地运行,请右键单击地狱世界.py,选择“运行方式”–>;“运行配置”,创建一个新的“PyDev Google App Run”。在

  1. 在主选项卡->主模块中,手动键入“dev”的目录路径_应用服务器.py“. “浏览”按钮无法帮助您,请手动键入。 enter image description here

  2. 在Arguments选项卡->;Program Arguments中,输入“${project_loc}/src”。 enter image description here

  3. 跑吧。默认情况下,它将部署到本地主机:8080。 enter image description here

  4. 完成了。 enter image description here

相关问题 更多 >