404 error: no user matches the given query?
I am busy with my group profile app and whenever i click on the create_group link i get this error instead of the create_group page. I think the problem may be in my URLS.PY file, has anybody ran into this problem. I am at work so will post some code in a few hours.
UPDATE:
The issue was i开发者_运维问答n my URLS.py project file, i guess it wasn't syncing well with my urls.py app file. Such a small issue but it was really frustrating. Thats the life of a newbe!
I had same problem. URL localhost:8000/admin/auth/user/add/ created 404. Solution was obvious after I first found it.
My accounts app had missing ^ in accounts/url.py:
urlpatterns = patterns('',
url(r'user/(?P<username>\w+)/$', 'accounts.views.profile')
)
So I fixed it:
urlpatterns = patterns('',
url(r'^user/(?P<username>\w+)/$', 'accounts.views.profile')
)
The original matched with .../user/add/ before admin urls.py and caused the 404.
This is a very vague question, and without your code it's almost impossible to answer you correctly. However, I'll take a stab at it. It seems to me that you may be using the get_object_or_404 method in your view? Or is this an admin view? Either way, the answer is the same: You have a group profile and a reference to a user from that group that doesn't exist. It seems like you may just have data inconsistencies in your DB. I may be way off, it's hard to tell with so little information. If you give me more information to work off, I'll amend my answer to give you a more complete response.
One thing I can tell you for sure is that is NOT a missing URL error message. That error message is sending a 404 back because it can't retrieve an object from the DB. This would occur after the URL pattern was matched. However, I guess it's also possible that it's a user session issue, where you were logged in with a user that no longer exists, but that's just conjecture.
Good luck!
精彩评论