Sunday, December 31, 2017

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)

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/<int:content_type_id>/<path:object_id>/ [name='view_on_site']
...... (corresponds to the tables defined)
admin/ ^(?P<app_label>rsi|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
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment