How to specify the login_required redirect url in django?

后端 未结 7 1277
既然无缘
既然无缘 2020-12-13 23:04

I have a view function:

@login_required
def myview():
    # do something
    # respond something
    pass

How can I specify the exact URL f

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 23:58

    default login url is: '/accounts/login/'
    if you want to change it then go to settings.py

    LOGIN_URL='/path/to/url'
    LOGIN_REDIRECT_URL='/path/to/redirecturl'
    

提交回复
热议问题