简体   繁体   English

Google App Engine空白页localhost:8080

[英]Google App Engine Blank page localhost:8080

I am getting a blank page in "localhost:8080". 我在“ localhost:8080”中得到一个空白页。

Followed the process mentioned in developers.google.com/appengine for python 遵循了developers.google.com/appengine for python中提到的过程

Everything is working fine but the webpage is not displaying "hello world" as mentioned in the helloworld.py file. 一切工作正常,但是网页没有显示helloworld.py文件中提到的“ hello world”。

import webapp2

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

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

and app.yaml file is 和app.yaml文件是

application: engineapp
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico

- url: .*
script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

First of all if your main file is named helloworld.py then you will have to change the line main.app to helloworld.app or change your filename to match the first part. 首先,如果您的主文件名为helloworld.py则必须将main.app行更改为helloworld.app或更改文件名以匹配第一部分。

Also as Martijn already mentioned your indentation should be correct in order to see the Hello World! 另外,正如Martijn已经提到的那样,您的缩进应该正确才能看到Hello World! and in what you posted in your question is totally not. 而您在问题中发布的内容完全没有。

Here is the corrected ones 这是更正的

import webapp2

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

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

and the app.yaml : app.yaml

application: engineapp
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM