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

前端 未结 2 1163
孤街浪徒
孤街浪徒 2020-12-29 06:19

I´m working on a course exercise and I\'m stuck for a few hours and I\'m not sure what is causing the app to break, next, you will find the files involved and perhaps you ca

相关标签:
2条回答
  • 2020-12-29 06:29

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

    For example, like:

    wrong - {% url 'accuant:dashboard' %}
    right - {% url 'account:dashboard' %}
    
    0 讨论(0)
  • 2020-12-29 06:33

    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')
    
    0 讨论(0)
提交回复
热议问题