[Django]-Django 2.0 – Not a valid view function or pattern name (Customizing Auth views)

40👍

You’ve set a namespace for your urls:

app_name = 'account'

You need to use that namespace when reversing urls with reverse/reverse_lazy or {% url %}:

LOGIN_REDIRECT_URL = reverse_lazy('account:dashboard')
LOGIN_URL = reverse_lazy('account:login')
LOGOUT_REDIRECT_URL = reverse_lazy('account:logout')
👤knbk

3👍

Perhaps when specifying {% url ‘appname:views’ %} you specified the wrong appname

For example, like:

wrong - {% url 'accuant:dashboard' %}
right - {% url 'account:dashboard' %}

Leave a comment