Google is useless in this case, it seems I am the first to encounter this error :/ Works fine on my Mac, but using the same files on a Windows 8 rig gives the following error in the logs when trying to request static assets like CSS files and images. Here is a snippet of the error:
INFO 2014-06-08 14:42:28,431 module.py:639] default: "GET /css/rootStyles.css HTTP/1.1" 200 5454
ERROR 2014-06-08 14:42:28,431 module.py:714] Request to '/css/rootStyles.css' failed
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 710, in _handle_request
return handler.handle(match, environ, wrapped_start_response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\static_files_handler.py", line 369, in handle
return self._handle_path(full_path, environ, start_response)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\static_files_handler.py", line 182, in _handle_path
start_response('200 OK', headers)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 640, in wrapped_start_response
return start_response(status, response_headers, exc_info)
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.
INFO 2014-06-08 14:42:28,433 module.py:639] default: "GET /css/rootStyles.css HTTP/1.1" 500 -
My app.yml file looks like this:
application: foobarbaz
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /img
static_dir: img
- url: /font
static_dir: font
- url: /css
static_dir: css
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest
Weird. Another person had a static files 500 error on Windows yesterday. This may be a GAE bug, where the mimetype guess is sent as a python unicode string in the header. Try adding mime_type: "text/css"
to your - url: /css
, as follows:
- url: /css
static_dir: css
mime_type: "text/css"
in app.yaml. I don't think this will solve the problem, but will help diagnose. You will most likely get another error on the img and font headers.
You can use wildcard mapping for the others:
- url: /img/(.*\.gif)$
static_files: img/\1
upload: img/.*\.gif$
mime_type: "image/gif"
- url: /img/(.*\.png)$
static_files: img/\1
upload: img/.*\.png$
mime_type: "image/x-png"
- url: /img/(.*\.jpg)$
static_files: img/\1
upload: img/.*\.jpg$
mime_type: "image/jpeg"
and similar for fonts. Like I said, this may just be a patch to a bug in GAE for Windows. I don't fully understand the handshake between the request and response, but you could experiment with adding the following as the first <meta>
tags in your template, to see if that improves the communication:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta charset="UTF-8">
I had the same issues using GAE SDK 1.9.6 on Windows 8.1 using python 2.7.7 (I only use the python version and haven't experienced this using Go SDK).
I just updated to python 2.7.8 and it seems that the issues are resolved.
Just wanted to share this out here, and see if other's can confirm this. I've also added this result to the bug that @Bradley had filed. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With