I create a test app locally using App Engine GO. I have bootstrap.css and bootstrap.js at the same folder and the two files have exactly same content. The file path and handlers as following.
css/bootstrap/bootstrap.css
css/bootstrap/bootstrap.js
handlers:
- url: /css
static_dir: css
Loading bootstrap.js (localhost:8080/css/bootstrap/bootstrap.js) works fine. But bootstrap.css (localhost:8080/css/bootstrap/bootstrap.css) can not be loaded at all, has 500 Internal Server Error. The server log as following.
c:\Apps\Google\appProjects\myapp>goapp serve
INFO 2014-07-19 08:57:00,200 devappserver2.py:765] Skipping SDK update check .
WARNING 2014-07-19 08:57:00,211 api_server.py:374] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2014-07-19 08:57:00,230 api_server.py:171] Starting API server at: http ://localhost:49980
INFO 2014-07-19 08:57:00,236 dispatcher.py:182] Starting module "default" ru nning at: http ://localhost:8080
INFO 2014-07-19 08:57:00,242 admin_server.py:117] Starting admin server at: http ://localhost:8000
INFO 2014-07-19 08:58:26,872 module.py:627] default: "GET / HTTP/1.1" 200 13 50
INFO 2014-07-19 08:58:26,914 module.py:627] default: "GET /css/bootstrap/boo tstrap.js HTTP/1.1" 304 -
INFO 2014-07-19 08:58:27,943 module.py:627] default: "GET /favicon.ico HTTP/ 1.1" 200 1354
INFO 2014-07-19 08:58:37,127 module.py:627] default: "GET /css/bootstrap/boo tstrap.js HTTP/1.1" 304 -
INFO 2014-07-19 08:58:38,219 module.py:627] default: "GET /favicon.ico HTTP/ 1.1" 200 1354
INFO 2014-07-19 08:59:38,157 module.py:627] default: "GET /css/bootstrap/boo tstrap.css HTTP/1.1" 200 145168
ERROR 2014-07-19 08:59:38,157 module.py:675] Request to '/css/bootstrap/boots trap.css' failed
Traceback (most recent call last):
File "C:\Apps\Google\go_appengine\google\appengine\tools\devappserver2\module. py", line 671, in _handle_request
return handler.handle(match, environ, wrapped_start_response)
File "C:\Apps\Google\go_appengine\google\appengine\tools\devappserver2\static_ files_handler.py", line 326, in handle
return self._handle_path(full_path, environ, start_response)
File "C:\Apps\Google\go_appengine\google\appengine\tools\devappserver2\static_ files_handler.py", line 181, in _handle_path
start_response('200 OK', headers)
File "C:\Apps\Google\go_appengine\google\appengine\tools\devappserver2\module. py", line 628, in wrapped_start_response
return start_response(status, response_headers, exc_info)
File "C:\Apps\Google\go_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-07-19 08:59:38,161 module.py:627] default: "GET /css/bootstrap/boo tstrap.css HTTP/1.1" 500 -
INFO 2014-07-19 08:59:39,178 module.py:627] default: "GET /favicon.ico HTTP/ 1.1" 200 1354
It looks like there is "TypeError". How to fix this error? How to load CSS file?