簡體   English   中英

Google App Engine本地主機服務器錯誤python

[英]Google app engine localhost server error python

我只是想在Google App Engine中運行Hello World程序。 但是,當我嘗試在瀏覽器上運行該應用程序時,出現500服務器錯誤。 我嘗試重新安裝GAE應用引擎啟動器和python 2.7.5。 但是沒有運氣!

這是我的hello.py

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


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

的app.yaml

application: silent-blend-359
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
    script: hello.application

日志很大,所以我在這里粘貼了它http://paste.ubuntu.com/6195427/

解決了

我正在使用代理連接到互聯網。 剛剛禁用代理和瞧! 問題解決了!

引言是Python語法的一部分。 正確縮進:

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')

並且,替換app.yaml以下行( hello.py沒有application ,但是app ):

hello.application

有:

hello.app

hello.py

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


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

的app.yaml

application: silent-blend-359
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: hello.app

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM