How to configure where to redirect after a log out in Django?

DJ.MaSs picture DJ.MaSs · Mar 15, 2011 · Viewed 77.7k times · Source

Just wondering where I can set the url to redirect to after logout. I know you can set the login url. I want to redirect to my home page.

Answer

Yuji 'Tomita' Tomita picture Yuji 'Tomita' Tomita · Mar 15, 2011

Modern Django (2017+?) has a setting called LOGOUT_REDIRECT_URL.

Older Djangos / Original Answer

You don't need to overwrite or wrap anything.

According to the docs, you can just supply the next_page argument to the logout view. https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.views.logout

(r'^logout/$', 'django.contrib.auth.views.logout',
                          {'next_page': '/successfully_logged_out/'})