簡體   English   中英

Google App Engine空白頁localhost:8080

[英]Google App Engine Blank page localhost:8080

我在“ localhost:8080”中得到一個空白頁。

遵循了developers.google.com/appengine for python中提到的過程

一切工作正常,但是網頁沒有顯示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)

和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"

首先,如果您的主文件名為helloworld.py則必須將main.app行更改為helloworld.app或更改文件名以匹配第一部分。

另外,正如Martijn已經提到的那樣,您的縮進應該正確才能看到Hello World! 而您在問題中發布的內容完全沒有。

這是更正的

import webapp2

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

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

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