web.py 图片和css文件500
使用了StaticMiddleware ,Static目录下css和图片文件访问500错误,报错如下
Traceback (most recent call last):
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver\__init__.py", line 1245, in communicate
req.respond()
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver\__init__.py", line 775, in respond
self.server.gateway(self).respond()
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver\__init__.py", line 2020, in respond
for chunk in response:
File "D:\python 2.7.7\lib\site-packages\web\httpserver.py", line 247, in __iter__
self.start_response(self.status, self.headers)
File "D:\python 2.7.7\lib\site-packages\web\httpserver.py", line 302, in xstart_response
out = start_response(status, response_headers, *args)
File "D:\python 2.7.7\lib\site-packages\web\wsgiserver\__init__.py", line 2058, in start_response
raise TypeError("WSGI response header value %r is not a byte string." % v)
TypeError: WSGI response header value u'text/css' is not a byte string.
后面加上了StaticMiddleware,依然无效
from web.httpserver import StaticMiddleware
app = web.application(urls, globals())
application = app.wsgifunc(StaticMiddleware)
風神騎士R
10 years, 4 months ago