网站未使用Google App Engine Launcher进行部署

时间:2014-05-13 21:55:29

标签: python html html5 python-2.7

我正在创建一个网站,我想把它放到网上。但是,有多少次我尝试使用Google App Engine Launcher进行部署,它将无法部署。

app.yaml文件:

application: GameDroidWeb
version: 1
runtime: python
api_version: 1

handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css))

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

- url: .*
  script: main.py

main.py:

# Copyright 2012 Digital Inspiration
# http://www.labnol.org/

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 ()

部署控制台日志:

2014-05-13 22:53:29 Running command: "['C:\\Python33\\pythonw.exe', '-u', 'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=TheAddictedGamerOfficial@gmail.com', '--passin', 'update', 'C:\\Users\\User\\Desktop\\WEBSITE TEST']"
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 126, in <module>
    run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 122, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
NameError: global name 'execfile' is not defined
2014-05-13 22:53:29 (Process exited with code 1)

You can close this window now.

有谁知道如何解决这个问题?我尝试过卸载并重新安装,但这也无效。任何帮助将不胜感激。 提前谢谢,

1 个答案:

答案 0 :(得分:2)

您正在使用python 3,您需要Python 2.7。

(Python SDK与Python 3不兼容。)来自here