谷歌应用引擎空白页本地主机:8080

2024-05-16 19:35:29 发布

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

我有一张空白页“本地主机:8080". 在

遵循中提到的流程developers.google.com/appengine对于python

一切正常,但网页没有显示“hello world”,如中所述地狱世界.py文件。在

import webapp2

class MainHandler(webapp2.RequestHandler):
def get(self):
    self.response.out.write('Hello world!')

app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)

以及应用程序yaml文件是

^{pr2}$

Tags: 文件selfcom网页helloworldgoogle世界
1条回答
网友
1楼 · 发布于 2024-05-16 19:35:29

首先,如果您的主文件名为helloworld.py,那么您必须将main.app更改为helloworld.app,或者更改文件名以匹配第一部分。在

同样,正如Martijn已经提到的那样,你的缩进应该是正确的,这样才能看到{},而你在问题中发布的内容则完全不正确。在

这是正确的

import webapp2

class MainHandler(webapp2.RequestHandler):
  def get(self):
    self.response.out.write('Hello world!')

app = webapp2.WSGIApplication([
    ('/', MainHandler)
  ], debug=True)

以及应用程序yaml

^{pr2}$

相关问题 更多 >