我試圖從python遷移到2.7到2.5,但在對main.py和app.yaml文件進行必要的更改後,我的網站做了不行想要從2.5遷移到python 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, {}))
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
看到這個文檔:https://developers.google.com/appengine/docs/python/python25/migrate27 – voscausa