2014-01-31 87 views
0

我不知道爲什麼,但Django的刷新頁面太慢(在我的本地開發服務器)。我正在看日誌,它顯示了很多次:Django太慢,試圖加載圖像

[31/Jan/2014 08:14:28] "GET /questoes/fisica/data:image/png;base64,iVBORw0KGgoAA 
AANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllP 
AAAA7dJREFUeNqsWM1PE0EU3+7ShdJKoTRA8UYgIUKM3rmaEI0euXsw0YMHIZEbxBijEiIHLkb/A44SD 
YlXzkYPGBM+ri1NWz7aUmhp6+9tps10mLfdfrzkl2535r39zc77mvUdHh4abUoUCAD3xP/fQAFItWJkY 
mLC+e1p8eGPgQcC08ycf8BPgW2vhr0SeQa8AWIe5k4LvATiwCrwtZmS2WT8IfAL+OKRhCoxoftH2GqLy 
BLwHbhvdC53ha2lVrfmE/DKzbLP5yubplnt7e310f+rq6tqpVLxVatVy0VtHbgNLHohsupGIhQKFQG7v 
79f+8CLiwsjl8sVAZsxQbYTwFrDwpTwpaj4ptPu6+vLDw4OBkHA014QobOzs3yhUAgyUx4BP2rhq/rIe 
53GwMBAeXx83DMJEpobi8WCpMtMWeOc9TkwoyMRjUattrMedBkyM+KZN4isqDMDgUCuExIyGbKlGVpRi 
Szo8kQ4HA4ZXRLGVuzo6GhBJjKviw6dT5TLZSOTyRinp6cGQrV+n67hnEY6nTaur6+1PkM2NWTm5fCd0 
xDRhh89CKHpXCMijLGxMef6+PjYiRSSUqlUv6/arOlKMlcjQlV0qsGDTZPehpYIxurXRCSRSFByq5NQ5 
6hvhWwj8cm2p7A9UdKYVBX8fn+F2+tIJGIgmzaQkUnYtm0MDw+zvsLYniQiEc2q/WxxwmqRHxrISA9xx 
iyLDzTGdsRsJwJoK3QPo3vctnhpAzLqTexhiVOg6JAdU5bLy0vHZ+Ro8mg7Q0QO1LvwenZZJycnN3yCI 
PsMRRYnjO0DU/SY+wprW7fiWmjKJMgnUIcafEaeo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xwmqRHxrISA9xx 
iyLDzTGdsRsJwJoK3QPo3vctnhpAzLqTexhiVOg6JAdU5bLy0vHZ+Ro8mg7Q0QO1LvwenZZJycnN3yCI 
PsMRRYnjO0DU/SY+wprW7fiWmjKJMgnUIcafEaeoxZCJWJI9lH4UjV2u6pSPp/XJR9jaGiIKrERDAbrj 
llzYOQJZ4zm6ISxuSsntB3gqTyazWZtMowa0aBFb4HegC6aRkZG2C2hLSObmqEdOcVvUdJUZyBlZ7tVa 
1ASdEUvjW3ZUqvvO82e3kqlUuVOSZANvBFd0fugawM2VKclOT8/tzohQ7pkgzn/rHNdvLbLJkPxeDzHR 
RIXIaTDkCB57XacoJPZW8bZQpSskslk0Y0QjdEcmstsB8myegrsYbqmENfJU3dOpZyOEwjdCqLIWUyxW 
KygVzHFccJ2eVkbar/qdq5ZFC3/R5dUb6EBsqQmyEtLuawj0eykRwpPgL0uRO+esLXW7tmX9nEWeAEk2 
yCQFLqzzb4MeK3Zn4FRsapNEXqGy2eJTTF3VOh27bOE/Ia2pQ81YeCO+P+XknGrH2pq8l+AAQDv/n2Gm 
q99BgAAAABJRU5ErkJggg== HTTP/1.1" 404 16622 

看時間戳!在簡單的重新加載過程中差不多有30秒...

有誰知道我該如何解決這個問題? 我認爲它的任何與靜態/媒體文件...我認爲這些文件上傳...(我正在刷新一個用html內容寫的文章頁面(所以這些文章有圖像等)

謝謝這麼多

UPDATING:

我的HTML視圖:! {{question.statement |安全}}

我在一個循環上面的代碼聲明與文本字段的HTML內容如:

<p>Um laborat&oacute;rio realiza exames em que &eacute; poss&iacute;vel<br />observar a taxa de glicose de uma pessoa. Os resultados<br />s&atilde;o analisados de acordo com o quadro a seguir.</p> <p><img src="/media/uploads/questoes/individuais/9000000021%202014-01-31%2015.25.jpg" alt="" width="562" height="272" /></p> <p>Um paciente fez um exame de glicose nesse laborat&oacute;rio e<br />comprovou que estava com hiperglicemia. Sua taxa de glicose<br />era de 300 mg/dL. Seu m&eacute;dico prescreveu um tratamento em<br />duas etapas. Na primeira etapa ele conseguiu reduzir sua<br />taxa em 30% e na segunda etapa em 10%.</p> <p>Ao calcular sua taxa de glicose ap&oacute;s as duas redu&ccedil;&otilde;es, o<br />paciente verificou que estava na categoria de</p> 

因此,內容是指我上傳到服務器的「/ media」圖像。

而在我的HTML佈局我有一些圖像靜態標籤,像(主要是佈局的目的):

{% static 'img/ico/icotop.png' %} 

是什麼問題?

+0

您可以發佈您在視圖中編寫的html和代碼。 – Prateek

+0

zzz。你是否將圖像發佈到網址中?你好嗎?!但這就是它的樣子。它需要很長的時間,因爲首先你在請求url中上傳整個圖像。這很少是你想要做的。當然,它會得到一個404響應。 <在這裏插入一些貶義> –

+0

我剛更新併發布了我的代碼! –

回答

0

我認爲在view.py你傳遞圖像作爲Httpesponse沒有mimetype。另外嘗試避免Django服務圖像。 Apache/Web服務器可以非常快速地爲您處理這項工作..

+0

我如何在開發階段處理它?我的意思是,在我的localhost測試? –

+0

你可以在這裏粘貼這些代碼嗎?不用看代碼就很難猜測你想要做什麼以及應該怎樣處理你的問題。將其與文件名一起粘貼。 –