2014-01-17 81 views
1

我上傳谷歌App Engine的應用程序,它是在URL developers.google.com/appengine/docs/python/memcache/usingmemcache#Memcache谷歌App Engine的留言應用程序提供錯誤

當我運行在谷歌應用程序App Engine的啓動,運行,但該網站顯示: (第一個錯誤是有我們沒有的Python「PIL」模塊,但我不使用圖像能否請你建議是什麼原因造成的錯誤

*** 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 - 
+0

以下地址答案的問題上面列出的錯誤的至少一個(「GET /favicon.ico ......」),這樣下來,投票不是很客氣的開始。 –

回答

0

確保?您在上傳應用程序的路徑中包含以下文件:

  1. index.yaml(自動生成;此時您不需要添加或更改任何內容)。

  2. favicon.ico(正確的格式;如果我沒有記錯,應該是16x16或32x32像素)。

  3. main.py(映射在你的網站的所有路徑;下面的例子給出):

    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), 
    ]) 
    
  4. 的app.yaml(包含以下內容;使用<...>在您需要設置的值):

    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 
    

Note

如果您希望避免處理'favicon.ico'請求,那麼您必須刪除文件'app.yaml'中的引用。

補充

您將需要實現所有在 'main.py' 進口請求處理程序。

在上面的例子中,「main.py」希望能夠找到它們命名爲「服務器」一個Python模塊中。

每個請求處理程序必須繼承class RequestHandler,從webapp2進口。

補充#2

爲了解決「PIL」的問題(也有類似的問題,如果記錯),只需安裝它。

從Windows命令行中輸入:PIP安裝PIL。

+1

我更新了main.py文件。我寫了「application =」,而不是「app =」,現在它可以工作。 – user3208259

+0

首先,如果在文件app.yaml中有'script:main.app'(如我在上面的回答中),那麼這個變量的名字應該是'app'。所以你的app.yaml文件中可能有'script:main.application'。其次,你爲什麼向下投票這個答案? –

+0

是的,在我的app.yaml文件中是main.application。謝謝。我沒有投票。我甚至沒有看到任何投票簽名與我的登錄。 – user3208259

相關問題