0

我只是想在谷歌应用程序引擎中运行hello世界程序。但是,当我尝试在浏览器上运行应用程序时,出现500服务器错误。我尝试重新安装GAE应用程序引擎启动器和python 2.7.5。但没有运气!谷歌应用引擎本地主机服务器错误python

这里是我的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/

解决

我在使用代理连接到互联网。只是禁用代理,瞧!问题解决了!

+0

你此刻也运行樱桃PY?也许它正在走这个港口。 –

回答

1

Indendation是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 
+0

这是一个粘贴错误。我检查了缩进。那是对的。 –

+0

@anik_das,我明白了。我更新了答案。 – falsetru

+0

是否做到了。仍然没有运气。 –

相关问题