2👍
✅
Dan Klasson’s comment is the answer. Just to elaborate a bit, you could have found out easily by testing your regexp:
>>> import re
>>> re.match(r"^(?P<username>[\w.@+-_]+)/$", "foobar/changepassword/")
<_sre.SRE_Match object at 0x7f949c54be40>
FWIW the problem is with the \w
specifier which might not do exactly what you expect:
>>> re.match(r"\w", "foobar/changepassword/")
<_sre.SRE_Match object at 0x7f949c5a1d30>
Source:stackexchange.com