It looks like it's related to the sites framework:
http://docs.djangoproject.com/en/dev/ref/contrib/sites/
I'd have a look at what's in my settings file for SITE_ID and take it
from there.
http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SITE_ID
Let us know if you don't figure it out.
Best,
Gabe
Thanks; unfortunately I haven't been able to move much further along.
The SITE_ID setting is set to 1, which was automatically generated. My project doesn't reference it anywhere. The docs say the default
is "not defined" so I tried deleting it, but then it gave me another error (complaining it wasn't defined). Setting it to 0 (a value I thought
could be sensible) didn't work either.
Checking the local variables in the exception stack trace, it seems the ID is passed properly (at the place where it crashes, in
django/db/models/query.py in get
the "pk" parameter is 1, which is set at one point below in the stack from "sid" (which I assume is
site_id).
The code that crashes is this:
• if self.query.can_filter():
• clone = clone.order_by()
• num = len(clone)
• if num == 1:
• return clone._result_cache[0]
• if not num:
• raise self.model.DoesNotExist("%s matching query does not exist."
• % self.model._meta.object_name) ...
• raise self.model.MultipleObjectsReturned("get() returned more than one %s -- it returned %s! Lookup parameters were %s"
• % (self.model._meta.object_name, num, kwargs))
In this case, 'num' is nil, and self.model._meta.object_name is 'Site'.
That's all I've been able to dig out; I'd appreciate any further help.
I'm surprised I ran into this problem because I was just strictly following the tutorial, and I've basically just added some 10 lines of code
to the project. I don't understand what could have gone wrong.
Thanks,
Ivan
>
>
> Best,
> Gabe
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
Since the exception said " 'Site' matching query does not exist", and the docs said something about the SITE_ID describing the site in the django_site database table, I went ahead and took a look at my (sqlite) database. The django_site table was empty, so I added a row with id==1 (the same that I have in settings.py) and then it worked.
However, I still don't understand what went wrong. Who should be responsible for putting that table row in the database? I ran syncdb several times (to make sure I didn't miss it :) ), but it didn't help.
Ivan
On May 18, 2011, at 8:34 AM, Gabriel Gunderson wrote: