I have a view
@login_required
def dashboard(request):
if request.session.get("pending-token"):
return redirect("speaker_create_token",
request.session["pending-token"])
return render(request, "dashboard.html")
and a row in urls.py
url(r'^dashboard/', dashboard, name='dashboard'),
When I open /dashboard/ with logged user, I see page. My html code is for authentication is
<div>
<div id="user">
{% if user.is_authenticated %}
<snap><a href="{% url 'profile' %}">{{ user.username }}</a> </snap>
<snap><a href="{% url 'logout' %}">Logout</a> </snap>
{% else %}
<snap><a href="{% url 'login' %}">Sign In</a> </snap>
<snap><a href="{% url 'create_user' %}">Sign Up</a> </snap>
{% endif %}
</div>
</div>
When I try to request /dashboard/ without logging I get the error
NoReverseMatch at /dashboard/
Reverse for 'account_login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
I added LOGIN_URL = '/accounts/login/' to settings.py, but it does not work. I saw similar questions, but I still can not understand how to avoid this error.