Re: 404 for some matching urls too (Version 2)
On Dec 31, 2017 7:26 AM, "Sundararajan Seshadri" 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. https://docs.djangoproject.com/en/2.0/topics/http/urls/# what-the-urlconf-searches-against 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+unsubscr...@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.
Re: 404 for some matching urls too (Version 2)
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. On Friday, December 29, 2017 at 5:39:15 PM UTC+5:30, Sundararajan Seshadri wrote: > > I do not know the mistake I am likely to be committing. In Django Version > 2, I have a feeling that URL matching fails whenever there are query > variables. > > When I try to log into Admin module, the login screen comes. But when a > 'next' query variable is attached, I get a 404. Similarly when I try to > jump to a page in the records listing, I get 404. (Color has been added for > highlighting) > > http://localhost:8000/admin/login/?next=/admin/ > > Using the URLconf defined in sundar.urls, Django tried these URL patterns, > in this order: > > admin/ [name='index'] > admin/ login/ [name='login'] > admin/ logout/ [name='logout'] > admin/ password_change/ [name='password_change'] > admin/ password_change/done/ [name='password_change_done'] > admin/ jsi18n/ [name='jsi18n'] > admin/ r/// [name='view_on_site'] > .. (corresponds to the tables defined) > admin/ ^(?Prsi|auth)/$ [name='app_list'] > login/ [name='login'] > logout/ [name='logout'] > authissue [name='authissue'] > . > > The current path, admin/login/?next=/admin/, didn't match any of these. > > Any help is appreciated. > > > > -- 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+unsubscr...@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/ada11420-3dbf-4af0-acc2-2ff3aa7cdd3b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: 404 for some matching urls too (Version 2)
admin/ [name='index'] admin/ login/ [name='login'] admin/ logout/ [name='logout'] admin/ password_change/ [name='password_change'] admin/ password_change/done/ [name='password_change_done'] admin/ jsi18n/ [name='jsi18n'] admin/ r/// [name='view_on_site'] .. (corresponds to the tables defined) admin/ ^(?Prsi|auth)/$ [name='app_list'] login/ [name='login'] logout/ [name='logout'] authissue [name='authissue'] . The current path, admin/login/?next=/admin/, didn't match any of these. It looks like you have two different URL's named 'login'. Try changing one of them so that they are unique. -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+unsubscr...@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%2BciXnKD3g5QG1mfpKVJ3jtr%2BrPU2iDPTkV-HU3m6oEZoD9w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: 404 for some matching urls too (Version 2)
Please post your urls.py, this looks strange: admin/ [name='index'] > admin/ login/ [name='login'] > admin/ logout/ [name='logout'] > admin/ r/// [name='view_on_site'] > admin/ ^(?Prsi|auth)/$ [name='app_list'] > login/ [name='login'] > logout/ [name='logout'] > authissue [name='authissue'] > -- 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+unsubscr...@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%2BFDnhLJs8SWgvHiE2fg4jbyV%3DVWuLAGBALEZWi4X5V3DQNRDQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
404 for some matching urls too (Version 2)
I do not know the mistake I am likely to be committing. In Django Version 2, I have a feeling that URL matching fails whenever there are query variables. When I try to log into Admin module, the login screen comes. But when a 'next' query variable is attached, I get a 404. Similarly when I try to jump to a page in the records listing, I get 404. (Color has been added for highlighting) http://localhost:8000/admin/login/?next=/admin/ Using the URLconf defined in sundar.urls, Django tried these URL patterns, in this order: admin/ [name='index'] admin/ login/ [name='login'] admin/ logout/ [name='logout'] admin/ password_change/ [name='password_change'] admin/ password_change/done/ [name='password_change_done'] admin/ jsi18n/ [name='jsi18n'] admin/ r/// [name='view_on_site'] .. (corresponds to the tables defined) admin/ ^(?Prsi|auth)/$ [name='app_list'] login/ [name='login'] logout/ [name='logout'] authissue [name='authissue'] . The current path, admin/login/?next=/admin/, didn't match any of these. Any help is appreciated. -- 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+unsubscr...@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/89e14511-03d3-43e8-9603-0aaccdf7ca91%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.