The Build

16:53

Django: Site matching query does not exist

1 January 2017

I love Django a lot; it still surprises me how productive I can be in it. And, especially in more recent versions, the error handling for weird configuration problems is much, much better than it used to be.

But sometimes, you get an error whose origin is slightly mysterious. Thus, it can be helpful to have a log of what Django says, and what it means.

Today’s is:

Site matching query does not exist

This usually means one of two things:

  1. You forgot to create the record for the site in in your django_site table. If so, create a data migration or fixture!
  2. You forgot the SITE_ID setting in your settings.py entirely. I did this while moving a project from an old version of Django.

Comments are closed.