根据 Google App Engine doc ,脚本处理程序可以调用三种类型的Python脚本来处理URL模式的请求匹配。
A script: directive can contain either a file path ending in .py (meaning that the script uses CGI), or a Python module path, with package names separated by dots (meaning that the script uses WSGI). The last component of a script: directive using a Python module path is the name of a global variable in the module: that variable must be a WSGI app, and is usually called app by convention.
这三种类型及其用例有什么区别?
请您参考如下方法:
实际上,没有.app脚本文件。这不是有效的扩展名。相反,它是脚本中的一个变量。
例子
您可能会在 app.yaml 文件中看到如下内容:
handlers:
- url: /.*
script: application.app
在这种情况下,'.app' 部分是 application.py 中的一个变量,您可以在 application.py 中看到这样一段代码:
app = webapp2.WSGIApplication([
('/', MainPageHandler)
], debug=True)
