2010-10-24 54 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()函數添加請求上下文。