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.
In your logout view, after you logout the user for good, return HttpResponseRedirect(url). Please see here for more details.
Redirect to current page
<a href="{% url 'logout' %}?next={{ request.path | urlencode }}">{% trans "Logout" %}</a>
Tested in Django 1.9.
See also: Is it possible to pass query parameters via Django's {% url %} template tag?
add this in you project setting.py file
LOGOUT_REDIRECT_URL = '/'
you can write your URL between '' I use my index page for logout default redirect
Modern Django (2017+?) has a setting called LOGOUT_REDIRECT_URL
.
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/'})
Since Django 1.10, you can define a LOGOUT_REDIRECT_URL
(see the docs)