Hi all,

I have encountered a problem when trying to create views that have to
include the same string in name. I created two views below.

The problem is here, when I tried to make a post request to revoke_token
endpoint, this request always is handled by  'token/' endpoint(TokenView).
I debugged url Django resolver, as far as I understood, Django always check
include a string in the path, not an exact match. When it sees "token/"
words in "token/" URL, it says I found the URL path and return TokenView as
a handler. When I swap these two URL paths, it works well.

Is there anyone faced with this problem? Thanks in advance.

url("token/", TokenView.as_view(), name="token"),
url("revoke_token/", RevokeTokenView.as_view(), name="revoke-token"),

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANaiRw3mN7HEJ_t536dPD3ny0F6b8_hiDCmQ1J2mF5GD%3Dq2OSA%40mail.gmail.com.

Reply via email to