Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python上的GAE入门教程未运行_Python_Google App Engine - Fatal编程技术网

Python上的GAE入门教程未运行

Python上的GAE入门教程未运行,python,google-app-engine,Python,Google App Engine,试图运行helloworld应用程序从GAE入门,它给了我一个空白页 我有文件hell2/hell2.py: import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.write('Hello, webapp2 World!') app = webapp2.WSGIApp

试图运行helloworld应用程序从GAE入门,它给了我一个空白页

我有文件
hell2/hell2.py

import webapp2

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

app = webapp2.WSGIApplication([('/', MainPage)],
                          debug=True)
和同一目录中的文件
app.yaml

application: hell2
version: 1
runtime: python
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: hell2.py
谷歌页面上的教程说脚本应该有.app扩展名,但这会立即抛出一个错误。同样,使用python27作为运行时也找不到python,即Python2.7.3 btw。按原样运行,但浏览器不显示文本。
基于webapp的旧示例运行良好。我检查发现webapp2.py在SDK中。

运行时标记中的是python27,而不是python

你需要改变

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

在运行时标记中使用的是python27,而不是python

你需要改变

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

.app
不是扩展,而是Python模块
hell2
中的一个变量。因此,将app.yaml中的行更改为:

script: hell2.app

.app
不是扩展,而是Python模块
hell2
中的一个变量。因此,将app.yaml中的行更改为:

script: hell2.app

对的为了弄清楚这里发生了什么,“.app”不是一个扩展;这是一条通向WSGI应用程序的路径。如果改为使用变量“application”,它将是
hell2.application
。太棒了。昨天不会,现在它使用python27和.appCorrect运行。为了弄清楚这里发生了什么,“.app”不是一个扩展;这是一条通向WSGI应用程序的路径。如果改为使用变量“application”,它将是
hell2.application
。太棒了。昨天不会,现在它运行python27并使用.app。如果你得到答案,请将其标记为已接受。如果你得到答案,请将其标记为已接受。