我试图从Python 2.5迁移到Python 2.7,但每次都会遇到同样的错误.
我在Python 2.5中使用app.yaml文件和一个脚本main.py进行了一个非常简单的测试,它运行正常.它只是一个Hello World类型的脚本来检查everythin工作正常.
的app.yaml
application: sparepartsfinder
version: 1
runtime: python
api_version: 1
handlers:
- url: /blog
script: main.py
- url: /blog/new_entry
script: main.py
Run Code Online (Sandbox Code Playgroud)
main.py
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplication(
[('/', MainPage),
('/blog', MainPage),
('/blog/new_entry',MainPage),
('/blog/archive/.*',MainPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Run Code Online (Sandbox Code Playgroud)
当我更改为Python 2.7时,我会按照Google App Engine上的文档,在app.yaml和main.py脚本中进行更改.
的app.yaml
application: sparepartsfinder
version: 1
runtime: python27
api_version: 1
threadsafe: true …Run Code Online (Sandbox Code Playgroud)