我正在尝试将字体提供给离子应用。离子应用程序从手机运行,因此原点是'file://'(对于所有CORS而言,它是'null')。
我在服务器提供的css文件中定义了一个字体
@font-face {
font-family: Ionicons;
src: url(/static/assets/fonts/ionicons/ionicons.eot?v=2.0.1);
src: url(/static/assets/fonts/ionicons/ionicons.eot?v=2.0.1#iefix) format("embedded-opentype"),
url(/static/assets/fonts/ionicons/ionicons.ttf?v=2.0.1) format("truetype"),
url(/static/assets/fonts/ionicons/ionicons.woff?v=2.0.1) format("woff"),
url(/static/assets/fonts/ionicons/ionicons.woff) format("woff"),
url(/static/assets/fonts/ionicons/ionicons.svg?v=2.0.1#Ionicons) format("svg");
font-weight: 400;
font-style: normal
}
这是我在服务器中遇到的错误:
[16/Jan/2016 15:30:52] "GET /static/assets/fonts/ionicons/ionicons.woff HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 63567)
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python34\lib\wsgiref\handlers.py", line 179, in finish_response
self.write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 278, in write
self._write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 452, in _write
self.stdout.write(data)
File "C:\Python34\lib\socket.py", line 394, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "c:\src\ravkav-store\venv\lib\site-packages\django\core\servers\basehttp.py", line 95, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Python34\lib\wsgiref\handlers.py", line 367, in handle_error
self.finish_response()
File "C:\Python34\lib\wsgiref\handlers.py", line 179, in finish_response
self.write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 273, in write
self.send_headers()
File "C:\Python34\lib\wsgiref\handlers.py", line 330, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python34\lib\wsgiref\handlers.py", line 343, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\socketserver.py", line 617, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python34\lib\socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\src\ravkav-store\venv\lib\site-packages\django\core\servers\basehttp.py", line 102, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python34\lib\socketserver.py", line 673, in __init__
self.handle()
File "c:\src\ravkav-store\venv\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle
handler.run(self.server.get_app())
File "C:\Python34\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python34\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
这很可能是开发服务器的问题,因为它在从nginx提供文件时起作用。