0

Python から 2.7 から 2.5 に移行しようとしていますが、main.py および app.yaml ファイルに必要な変更を加えた後、サイトが機能しません

助けてください...動作させるには、これらにどのような変更を加える必要がありますか

main.py

import os
from google.appengine.ext import webapp

from google.appengine.ext.webapp import util

from google.appengine.ext.webapp import template

class MainHandler(webapp.RequestHandler):
  def get (self, q):
    if q is None:
      q = 'index.html'

    path = os.path.join (os.path.dirname (__file__), q)
    self.response.headers ['Content-Type'] = 'text/html'
    self.response.out.write (template.render (path, {}))

def main ():
  application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
  util.run_wsgi_app (application)

if __name__ == '__main__':
  main ()

app.yaml

application: cool-gadgets    
version: 1    
runtime: python    
api_version: 1    

handlers:
- url: /robots.txt
  static_files: static/robots.txt
  upload: static/robots.txt

- url: /favicon.ico
  static_files: static/favicon.ico
  upload: static/favicon.ico

- url: /gadgets/disney.xml
  static_files: gadgets/disney.xml
  upload: gadgets/disney.xml

- url: /gadgets/wwe.xml
  static_files: gadgets/wwe.xml
  upload: gadgets/wwe.xml

- url: .*
  script: main.py

2.7に移行するためにこれに加えた変更

Main.py

import os
from google.appengine.ext import webapp

from google.appengine.ext.webapp import util

from google.appengine.ext.webapp import template

class MainHandler(webapp.RequestHandler):
  def get (self, q):
    if q is None:
      q = 'index.html'

    path = os.path.join (os.path.dirname (__file__), q)
    self.response.headers ['Content-Type'] = 'text/html'
    self.response.out.write (template.render (path, {}))


  application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)

app.yaml

application: cool-gadgets    
version: 1    
runtime: python27    
api_version: 1    
threadsafe: true    

handlers:
- url: /robots.txt
  static_files: static/robots.txt
  upload: static/robots.txt

- url: /favicon.ico
  static_files: static/favicon.ico
  upload: static/favicon.ico

- url: /gadgets/disney.xml
  static_files: gadgets/disney.xml
  upload: gadgets/disney.xml

- url: /gadgets/wwe.xml
  static_files: gadgets/wwe.xml
  upload: gadgets/wwe.xml

- url: .*
  script: main.application
4

1 に答える 1