drf-yasg
drf-yasg copied to clipboard
setting "LOGOUT_URL" has no effect!
Hi,
As documented here, setting variable LOGOUT_URL
in settings.py
should override the default value of LOGOUT_URL
(which sets to /accounts/logout/
by default).
but it seems it has no effect! regardless of setting LOGOUT_URL
or not, the LOGOUT_URL
will always be /accounts/logout/
.
Hi, As documented here, setting variable
LOGOUT_URL
insettings.py
should override the default value ofLOGOUT_URL
(which sets to/accounts/logout/
by default). but it seems it has no effect! regardless of settingLOGOUT_URL
or not, theLOGOUT_URL
will always be/accounts/logout/
.
I've found a way (an ugly one!) to kinda solve this problem. in your urls.py
file (Tested in Django 3+
):
from django.views.generic import RedirectView
urlpatterns += path('accounts/logout/', RedirectView.as_view(pattern_name='admin:logout', permanent=False))
But still it would be great if you solve this problem completely!
Documentation deprecated or not very clear at least.
So, to resolve the issue, pls do not use LOGIN_URL
and LOGOUT_URL
parameters in settings directly. Instead, use SWAGGER_SETTINGS
as below:
SWAGGER_SETTINGS = {
"LOGIN_URL": "/admin/login/",
"LOGOUT_URL": "/admin/logout/",
}
PS: issue with LOGOUT_URL
happens since it was hardcoded in default config: https://github.com/axnsan12/drf-yasg/commit/952332d90bf932637ead5f969de99c662592d13b
https://github.com/axnsan12/drf-yasg/issues/733#issuecomment-1126894958
I found setting this even in SWAGGER_SETTINGS
didn't have any effect, is this a known bug?