Search code examples
pythongoogle-app-enginecherrypy

The GAE SDK Console doesn't load the styles anymore


A few months ago I was working on a test GAE app. I was able to start the launcher and open the browser both on the app port and on the SDK Console port, and they both were working well.

Then I installed CherryPy, I created a CherryPy app, and I was able to browse to the app.

Today I restarted the GAE launcher. When I browse to my app page everything works well, while browsing to the SDK Console it shows the correct content, but doesn't show the static files.

The log mentions CherryPy.

  • Is the CherryPy I installed conflicting with GAE?
  • Does GAE use CherryPy (and my installation has nothing to do with it)?
  • How do I fix it?

For example when I browse to http://localhost:8002/assets/common.css (which is the css used by the SDK Console) I get the following log:

ERROR    2014-08-19 20:23:08,052 webapp2.py:1553] WSGI response header value u'text/css' is not of type str.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1547, in __call__
    return response(environ, start_response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webob-1.2.3\webob\response.py", line 1021, in __call__
    start_response(self.status, headerlist)
  File "C:\Program Files (x86)\Google\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 2155, in start_response
    raise TypeError("WSGI response header value %r is not of type str." % v)
TypeError: WSGI response header value u'text/css' is not of type str.
AssertionError('WSGI start_response called a second time with no exc_info.',)
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 1302, in communicate
    req.respond()
  File "C:\Program Files (x86)\Google\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 831, in respond
    self.server.gateway(self).respond()
  File "C:\Program Files (x86)\Google\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 2115, in respond
    response = self.req.server.wsgi_app(self.env, self.start_response)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py", line 266, in __call__
    return app(environ, start_response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.1\webapp2.py", line 1549, in __call__
    return self._internal_error(e)(environ, start_response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webob-1.2.3\webob\response.py", line 1021, in __call__
    start_response(self.status, headerlist)
  File "C:\Program Files (x86)\Google\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 2137, in start_response
    raise AssertionError("WSGI start_response called a second "
AssertionError: WSGI start_response called a second time with no exc_info.

Solution

  • There is a bug in the GAE Windows static file handling. It has been documented here:

    Google App Engine: Won't serve static assets with below error:

    Reported to be fixed by updating from Python 2.7.7 to 2.7.8. Otherwise, you will want to explicitly specify the MIME types for your static files in app.yaml, as shown on that linked page.