谷歌应用引擎localhost服务器错误python

时间:2013-10-05 07:19:40

标签: python google-app-engine python-2.7 internal-server-error

我只是想在谷歌应用引擎中运行hello world程序。但是当我尝试在浏览器上运行应用程序时,我收到500服务器错误。我尝试重新安装GAE app引擎启动器和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/

解决

我使用代理连接到互联网。刚刚禁用代理和瞧!问题解决了!

1 个答案:

答案 0 :(得分:2)

Indendation是Python语法的一部分。缩进正确:

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

并且,替换app.yaml中的以下行(application中没有hello.py,但是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
相关问题