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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c94cea9b-59be-41f3-ae1b-2a7c64156e8fn%40googlegroups.com.

Reply via email to