2010-10-24 56 views
3

我有一个带有静态图像的模板。本页面的每一个第二次调用图像不显示,我得到一个错误在控制台:显示静态内容时出错

Development server is running at http://127.0.0.1:8000/ 
Quit the server with CTRL-BREAK. 
[24/Oct/2010 11:25:36] "GET /index/ HTTP/1.1" 200 20058 
[24/Oct/2010 11:25:36] "GET /images/logo.png HTTP/1.1" 500 65126 
[24/Oct/2010 11:25:37] "GET /index/ HTTP/1.1" 200 20058 
[24/Oct/2010 11:25:37] "GET /images/logo.png HTTP/1.1" 200 6439 
[24/Oct/2010 11:25:39] "GET /index/ HTTP/1.1" 200 20058 
Traceback (most recent call last): 
    File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 281, in run self.finish_response() 
    File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 321, in finish_response self.write(data) 
    File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 417, in write 
self._write(data) 
    File "C:\Python27\lib\socket.py", line 322, in write 
self.flush() 
    File "C:\Python27\lib\socket.py", line 301, in flush 
self._sock.sendall(view[write_offset:write_offset+buffer_size]) 
error: [Errno 10053] An established connection was aborted by the software in your host machine 
Traceback (most recent call last): 
    File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock 
self.process_request(request, client_address) 
    File "C:\Python27\lib\SocketServer.py", line 310, in process_request 
self.finish_request(request, client_address) 
    File "C:\Python27\lib\SocketServer.py", line 323, in finish_request 
self.RequestHandlerClass(request, client_address, self) 
    File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 562, in __init__ 
    BaseHTTPRequestHandler.__init__(self, *args, **kwargs) 
File "C:\Python27\lib\SocketServer.py", line 641, in __init__ 
self.finish() 
    File "C:\Python27\lib\SocketServer.py", line 694, in finish 
self.wfile.flush() 
    File "C:\Python27\lib\socket.py", line 301, in flush 
self._sock.sendall(view[write_offset:write_offset+buffer_size]) 
error: [Errno 10053] An established connection was aborted by the software in your host machine 
---------------------------------------- 
Exception happened during processing of request from ('127.0.0.1', 38314) 
---------------------------------------- 

我怎样才能解决这个问题?

回答

2

也许你有另一个使用8000端口号的应用程序。你尝试过使用另一个端口号吗?

+0

我已经改变了端口号,但也有同样的问题。 – demas 2010-10-24 09:36:36

+0

不知道这是否会帮助您解决问题,但请查看以下链接:http://code.google.com/p/googleappengine/issues/detail?id=462 – Seitaridis 2010-10-24 10:33:51

+0

您是否使用其他服务器,例如Apache服务器?如果是这样,那么你是否遇到同样的问题? – Seitaridis 2010-10-24 10:36:03

0

这是一个与Chrome相关的问题。要停止获取这些错误,您必须在Chrome设置中取消选中“预测网络操作以提高网页加载效果”。

+0

+1。这解决了我的开发服务器上类似的错误。 – axoplasm 2013-06-02 16:04:02

1

检查您是否从视图中提供请求上下文。在我的情况下,当{{STATIC_URL}}缺失时发生这种情况,并且缺少它,因为我忘记向render_to_response()函数添加请求上下文。