drf-yasg icon indicating copy to clipboard operation
drf-yasg copied to clipboard

setting "LOGOUT_URL" has no effect!

Open omiid-ad opened this issue 3 years ago • 3 comments

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/.

omiid-ad avatar Aug 24 '21 11:08 omiid-ad

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/.

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!

omiid-ad avatar Aug 24 '21 11:08 omiid-ad

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

puhoshville avatar May 15 '22 09:05 puhoshville

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?

joemudryk avatar Jan 05 '23 23:01 joemudryk