开发者

Profile picture being cached

开发者 https://www.devze.com 2023-02-04 23:13 出处:网络
From Django i overwrite a existing photo.This photo is the profile picture of a user.I save the picture evertime as username.png on the server.So After which when the redirect is do开发者_如何学Gone t

From Django i overwrite a existing photo.This photo is the profile picture of a user.I save the picture evertime as username.png on the server.So After which when the redirect is do开发者_如何学Gone to /home page the old picture is cached by the browser.

How to overcome this problem

return HttpResponseRedirect('/home/')


See this resource for information on how to set the cache headers.

http://docs.djangoproject.com/en/dev/topics/cache/

Sets the Last-Modified header to the current date/time when a fresh (uncached) version of the page is requested. Sets the Expires header to the current date/time plus the defined CACHE_MIDDLEWARE_SECONDS. Sets the Cache-Control header to give a max age for the page -- again, from the CACHE_MIDDLEWARE_SECONDS setting.

Controlling these settings will ensure that the content that you don't want cached will be refreshed when the content is changed.

0

精彩评论

暂无评论...
验证码 换一张
取 消