1
votes

I upload the Google App Engine application which is at the url developers.google.com/appengine/docs/python/memcache/usingmemcache#Memcache

When I run the application on Google App Engine Launcher, it runs but the website shows: (First error is there us no Python "PIL" module but I am not using image. Could you please suggest what is causing the error?

*** 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 -
1
The answer below addresses at least one of the errors listed in the question above ("GET /favicon.ico ..."), so down-voting it isn't very polite to begin with.barak manos

1 Answers

0
votes

Make sure that you have the following files in the path that you are uploading your application from:

  1. index.yaml (auto-generated; you don't need to add or change anything in here at this point).

  2. favicon.ico (in the correct format; should be 16x16 or 32x32 pixels if I remember correctly).

  3. main.py (mapping all the paths in your web-site; example given below):

    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 (with the following contents; using <...> where you need to set a value):

    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:

if you wish to avoid handling 'favicon.ico' request, then you must remove the reference in file 'app.yaml'.

Supplemental:

You will need to implement all the request handlers imported in 'main.py'.

In the example above, 'main.py' expects to find them in a Python module named 'Server'.

Each request handler must inherit class RequestHandler, imported from webapp2.

Supplemental #2:

In order to solve the 'PIL' issue (had a similar problem if memory serves correctly), simply install it.

From a Windows command line, enter: pip install pil.