Google app engine 谷歌应用程序引擎留言簿应用程序出现错误

Google app engine 谷歌应用程序引擎留言簿应用程序出现错误,google-app-engine,Google App Engine,我上传了GoogleAppEngine应用程序,它的url是developers.Google.com/appengine/docs/python/memcache/usingmemcache#memcache 当我在Google App Engine Launcher上运行应用程序时,它会运行,但网站显示: (第一个错误是没有Python“PIL”模块,但我没有使用image。你能告诉我是什么导致了这个错误吗 *** Running dev_appserver with the followi

我上传了GoogleAppEngine应用程序,它的url是developers.Google.com/appengine/docs/python/memcache/usingmemcache#memcache

当我在Google App Engine Launcher上运行应用程序时,它会运行,但网站显示: (第一个错误是没有Python“PIL”模块,但我没有使用image。你能告诉我是什么导致了这个错误吗

*** Running dev_appserver with the following flags:
    --skip_sdk_update_check=yes --port=13080 --admin_port=8005
Python command: /usr/bin/python2.7
INFO     2014-01-17 20:43:22,217 devappserver2.py:660] Skipping SDK update check.
WARNING  2014-01-17 20:43:22,222 api_server.py:331] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO     2014-01-17 20:43:22,226 api_server.py:138] Starting API server at: localhost:55385
INFO     2014-01-17 20:43:22,230 dispatcher.py:171] Starting module "default" running at: localhost:13080
INFO     2014-01-17 20:43:22,238 admin_server.py:117] Starting admin server at: localhost:8005
ERROR    2014-01-17 20:43:24,601 wsgi.py:262] 
Traceback (most recent call last):
  File "/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 301, in _LoadHandler
    raise err
ImportError: <module 'guestbookw2' from '/Users/guestbookw2/guestbookw2.pyc'> has no attribute application
INFO     2014-01-17 20:43:24,607 module.py:617] default: "GET / HTTP/1.1" 500 -
ERROR    2014-01-17 20:43:24,727 wsgi.py:262] 
Traceback (most recent call last):
  File "/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 301, in _LoadHandler
    raise err
ImportError: <module 'guestbookw12' from '/Users/guestbookw2/guestbookw2.pyc'> has no attribute application
INFO     2014-01-17 20:43:24,732 module.py:617] default: "GET /favicon.ico HTTP/1.1" 500 -
***使用以下标志运行dev_appserver:
--跳过\u sdk\u更新\u检查=yes--port=13080--admin\u port=8005
Python命令:/usr/bin/python2.7
信息2014-01-17 20:43:22217 devappserver2.py:660]正在跳过SDK更新检查。
警告2014-01-17 20:43:2222 api_server.py:331]无法初始化图像api;您可能缺少Python“PIL”模块。
INFO 2014-01-17 20:43:22226 api_server.py:138]正在启动api服务器,地址:localhost:55385
INFO 2014-01-17 20:43:22230调度程序.py:171]正在启动模块“默认值”,运行于:localhost:13080
INFO 2014-01-17 20:43:22238 admin_server.py:117]正在本地主机8005上启动管理服务器
错误2014-01-17 20:43:24601 wsgi.py:262]
回溯(最近一次呼叫最后一次):
文件“/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py”,第239行,在句柄中
handler=\u config\u handle.add\u wsgi\u中间件(self.\u LoadHandler())
文件“/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/runtime/wsgi.py”,第301行,在LoadHandler中
提出错误
ImportError:没有属性应用程序
INFO 2014-01-17 20:43:24607 module.py:617]默认值:“GET/HTTP/1.1”500-
错误2014-01-17 20:43:24727 wsgi.py:262]
回溯(最近一次呼叫最后一次):
文件“/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py”,第239行,在句柄中
handler=\u config\u handle.add\u wsgi\u中间件(self.\u LoadHandler())
文件“/Users/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/runtime/wsgi.py”,第301行,在LoadHandler中
提出错误
ImportError:没有属性应用程序
INFO 2014-01-17 20:43:24732 module.py:617]默认值:“GET/favicon.ico HTTP/1.1”500-

确保在上载应用程序的路径中包含以下文件:

  • index.yaml(自动生成;此时无需在此处添加或更改任何内容)

  • favicon.ico(格式正确;如果我没记错的话,应该是16x16或32x32像素)

  • main.py(映射网站中的所有路径;下面给出的示例):

  • app.yaml(包含以下内容;在需要设置值的位置使用
    ):

    应用程序:
    版本:1
    运行时:python27
    api_版本:1
    线程安全:是的
    处理程序:
    -url:/favicon\.ico
    静态文件:favicon.ico
    上传:favicon\.ico
    -url:*
    脚本:main.app
    图书馆:
    -名称:webapp2
    版本:“2.5.1”//您可能还需要更改此版本
    
  • 注意

    如果希望避免处理“favicon.ico”请求,则必须删除文件“app.yaml”中的引用

    补充

    您需要实现在“main.py”中导入的所有请求处理程序

    在上面的示例中,“main.py”希望在名为“Server”的Python模块中找到它们

    每个请求处理程序必须继承从
    webapp2
    导入的
    类RequestHandler

    补充#2

    为了解决“PIL”问题(如果内存正常,也会出现类似问题),只需安装它


    在Windows命令行中,输入:pip install pil。

    下面的答案至少解决了上述问题中列出的一个错误(“GET/favicon.ico…”),因此开始时进行向下投票不是很礼貌。我更新了main.py文件。我写了“application=”而不是“app=”…现在它可以工作了。首先,如果在app.yaml文件中有“script:main.app”(如我上面的回答所示),那么这个变量的名称应该是
    app
    。所以你的app.yaml文件中可能有'script:main.application'。其次,为什么你否决了这个答案???是的,在我的app.yaml文件中它是main.application。谢谢。我没有否决投票。我甚至在登录时没有看到任何投票符号。
    from webapp2 import WSGIApplication
    from Server import MainRequestHandler
    from Server import SomeRequestHandler
    from Server import OtherRequestHandler
    
    app = WSGIApplication([
        ('/'              ,MainRequestHandler),
        ('/abc'           ,SomeRequestHandler),
        ('/def'           ,SomeRequestHandler),
        ('/xyz'           ,OtherRequestHandler),
    ])
    
    application: <the app-id you chose when use signed in for GAE>
    version: 1
    runtime: python27
    api_version: 1
    threadsafe: yes
    
    handlers:
    - url: /favicon\.ico
      static_files: favicon.ico
      upload: favicon\.ico
    
    - url: .*
      script: main.app
    
    libraries:
    - name: webapp2
      version: "2.5.1" // you might need to change this as well