I didn't use custom url, just added auth default url to url in my project 'path("accounts/", include("django.contrib.auth.urls")),and called login, logout url in template. Login works perfectly but logout does not work.
On Thu, 22 Feb 2024, 8:03 pm Okechukwu Ogo, <ogookechukwujos...@gmail.com> wrote: > Check your logout URL and view if there's a mistake > > On Thu, 22 Feb 2024, 14:27 AshiQul Islam Munna, <ashiq.cse.m...@gmail.com> > wrote: > >> Hello! >> >> I am using default auth system in my project these steps- >> >> 1. Add this in my project urls path("accounts/", include( >> "django.contrib.auth.urls")), >> >> 2. Create HTML file in -'templates/registration/login.html' >> >> 3. In 'base.html' i wrote - >> ' {% if user.is_authenticated %} >> <p>Hi {{ user.username }}!</p> >> <p><a href="{% url 'logout' %}">Log out</a></p> >> {% else %} >> <p>You are not logged in.</p> >> <a href="{% url 'login' %}">Log In</a> >> {% endif %} >> ' >> >> 4. And finally in 'setting.py' set >> LOGIN_REDIRECT_URL = "home" >> LOGOUT_REDIRECT_URL = "home" >> >> That's ALL! >> ' LOGIN ' works perfectly but "LOGOUT " not working. It say's- >> [image: Screenshot_96.png] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/c94cea9b-59be-41f3-ae1b-2a7c64156e8fn%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/c94cea9b-59be-41f3-ae1b-2a7c64156e8fn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/v2T9gA87vmA/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAMeYHes6XEoGcHAgLQqgXMPLwkU9dh%2BbV3k0vPcVGU8MEAZGuw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAMeYHes6XEoGcHAgLQqgXMPLwkU9dh%2BbV3k0vPcVGU8MEAZGuw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH%3DY28ps-3PpoWZF0h9cdVetX0zafE5tpE50bPRBPKgGeLdu3A%40mail.gmail.com.