I have a url like
http://localhost/user/?hash={hash value generated}
i need to configure urls.py so that any url of this form is recognized and does not give an error.
I currently wrote urls.py as
url(r'^user/(?P<hash>\w+)/$', 'Myapp.views.createnewpass'),
and this is giving a 404 error for a valid hash.
How can I correct this error?
Thanks in advance!
Well, it should be clear to you that the regex does not match the URL: it's looking for URLs in the form /user/hash/, whereas you have /user/?hash=hash.
In any case, query parameters (those after the ?) do not get processed by urls.py, they are passed in request.GET. So your URLconf should just be r'^user/$
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With