For example to avoid that after logout the back button from the browser redirects to the previous page (it should redirect to the login page), the browser cache can be cleared by the following:
... from django.views.decorators.cache import cache_control ... @cache_control(no_cache=True, must_revalidate=True, no_store=True): def view(request): ...
However, this means that all views need to be wrapped in that structure, and that none of those views will be catchable.
An alternative is to consider using @vary_on_cookie, which means that the cache will be specific to that user only for the current cookie value. A "logout" will clear the session cookies and thus renders the cache invalid.