Tuesday, January 2, 2018

Re: 404 for some matching urls too (Version 2)



On Dec 31, 2017 7:26 AM, "Sundararajan Seshadri" <sunsesh@gmail.com> wrote:
Thanks for the support and responses.

The error was due to an interesting line of code. 

I had a middleware where I used:

match = resolve(request.get_full_path()) and this was causing the error I mentioned.(get_full_path returns the query string too.)

I replaced it with

match = resolve(request.path_info)

and it is now working fine. Something to do with internal working? Any simple explanation for my curiosity will be welcome. 

Thanks everybody.

To me, this seems like intended and correct behavior. The URL dispatcher does not normally receive paths that include the query string. The query string is parsed separately and populates other portions of the request object such as request.GET and request.POST.


I'm not familiar with the resolve() function, but I assume it is calling the Django URL dispatch process.

-James

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVkPyBKvOfcwVU9kosxR9OrJ8OR_g-NpA8gHF5h28Arbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment