Admin 404s on users

8 views
Skip to first unread message

mail....@gmail.com

unread,
Dec 4, 2006, 8:10:29 AM12/4/06
to Django users
I just know there's a simple explanation for this, but my brain is
fried.

My admin area decided today it was going to start throwing a 404 error
for every user.

When I go to the admin, under "Auth" and click "users" all is well. I'm
presented with a list of users.

When I try to click one of the users - any of the users - it 404s. Even
if I click on my own user name.

Adrian Holovaty

unread,
Dec 4, 2006, 5:08:02 PM12/4/06
to django...@googlegroups.com
On 12/4/06, bax...@gretschpages.com <mail....@gmail.com> wrote:
> When I go to the admin, under "Auth" and click "users" all is well. I'm
> presented with a list of users.
>
> When I try to click one of the users - any of the users - it 404s. Even
> if I click on my own user name.

Try setting DEBUG=True and reading the 404 error page.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

mail....@gmail.com

unread,
Dec 4, 2006, 5:25:11 PM12/4/06
to Django users
It doesn't give me anything to go on:

Page not found (404)
Request Method: GET
Request URL: http://gretschpages.com/admin/auth/user/1/

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a standard
404 page.

MerMer

unread,
Dec 4, 2006, 5:49:57 PM12/4/06
to Django users
I had a similar problem the other day. I had made a mistake on one of
my fields of another model, which was edited inline via the User Model.

MerMer

mail....@gmail.com

unread,
Dec 4, 2006, 5:52:20 PM12/4/06
to Django users
Are you saying you broke your model?

Mine validate.

Or am I misunderstanding?

Adrian Holovaty

unread,
Dec 4, 2006, 11:34:46 PM12/4/06
to django...@googlegroups.com

Try running "manage.py syncdb" to install any permissions that might
be missing. I think an ObjectDoesNotExist exception is being raised
somewhere, causing the 404. I seem to recall having a similar problem
once, where the PermissionDoesNotExist exception was causing a 404.

MerMer

unread,
Dec 5, 2006, 3:44:25 AM12/5/06
to Django users
Yes, I broke the model that was being edited by the USER model. From
memory mine also validated OK, because the problem lay with some of the
data in the DB - not the actual structure of the model. That's why I
was able to see a complete USER list and only got the error when I
clicked on the individual record.

Merric

mail....@gmail.com

unread,
Dec 5, 2006, 9:55:10 AM12/5/06
to Django users
Syncdb didn't appear to do anything.

Adrian, I think you're right about ObjectDoesNotExist, and I think
something in my database is off... any Ideas how to track it down?

mail....@gmail.com

unread,
Dec 5, 2006, 11:00:50 PM12/5/06
to Django users
Grasping at straws here, but I've been running lots of comparison sql
statements looking for any disparities or oddities, things like:
Select user_id from auth_user_groups where user_id not in (select id
from auth_user)
and I notice that user 1 (admin, superuser, me) isn't in
auth_user_groups. That's normal, right?

This is just killing me... I can't figure out why the admin is flaking
on auth. I've noticed it freaks out on auth_users and auth_user_groups,
but nothing else, not even gp_users, which extends auth_users.

mail....@gmail.com

unread,
Dec 6, 2006, 4:05:16 PM12/6/06
to Django users
Also, I commented out all apps in settings.py except the "default"
django ones, and it still happened.

Anyone got any more ideas? I kind of need user admin!

Adrian Holovaty

unread,
Dec 7, 2006, 10:11:32 AM12/7/06
to django...@googlegroups.com

Hey Tim,

"svn update" your code, assuming you're using the Django development
version. Then, making sure DEBUG=True, try loading the admin user page
again. You will get a more useful error message. Let's cross our
fingers that the error message will help you debug what's wrong.

mail....@gmail.com

unread,
Dec 7, 2006, 10:19:10 AM12/7/06
to Django users
Ah ha!

DoesNotExist at /admin/auth/user/1/
ContentType matching query does not exist.


Request Method: GET
Request URL: http://gretschpages.com/admin/auth/user/1/

Exception Type: DoesNotExist
Exception Value: ContentType matching query does not exist.
Exception Location:
/home2/baxter/lib/python2.4/django/db/models/query.py in get, line 213

I'm not exactly sure what it means, but it's DEFINITELY more helpful.
Perhaps I should look at my content-type table?

mail....@gmail.com

unread,
Dec 7, 2006, 10:53:54 AM12/7/06
to Django users
Still no go... what the hell is it looking for?

Adrian Holovaty

unread,
Dec 7, 2006, 10:59:06 AM12/7/06
to django...@googlegroups.com
On 12/7/06, bax...@gretschpages.com <mail....@gmail.com> wrote:
> ContentType matching query does not exist.
> [...]

> I'm not exactly sure what it means, but it's DEFINITELY more helpful.
> Perhaps I should look at my content-type table?

Run this code:

"""
from django.contrib.contenttypes.management import create_contenttypes
from django.db.models import get_apps
for app in get_apps():
create_contenttypes(app, created_models=None, verbosity=2)

mail....@gmail.com

unread,
Dec 7, 2006, 11:09:19 AM12/7/06
to Django users
I got it!

I had a mismatch between content_types and permissions. Not sure how it
happened, but it's fixed!

Thanks to everyone, espeically Adrian, for your help. I feel like I can
actually use the admin again!

Reply all
Reply to author
Forward
0 new messages