[Answered ]-Redirection in django

1👍

Maybe the profile picture is cached by the browser. There are multiple ways to avoid it:

  • disable caching for the by changing the response headers for it. This is a bad idea for production because the picture would never be cached, so every page-request would fetch the picture, which massively increases the traffic

  • change the filename of the photo when it is update. You could i.e. use a hash of the content or something like SHA1(userid + timestamp of upload)

  • use a HTTP ETag in the response header of the picture

1👍

There’s a trick I read that consists in writing something like:

<img src="{{photo}}?version={{version}}"></img>

Where version is a new version number that you increase when your file is updated (you could alternatively use {{photo.file}} and {{photo.version}}).
This way the URL will be different and the browser will not used the cached version.

Leave a comment