On Tue, Mar 08, 2016 at 08:08:06PM -0800, Malte wrote: > Hi all, > > I ran into this error trying to migrate my apps with a blank Postgres > database. > > django.db.utils.ProgrammingError: relation "django_site" does not exist > > LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si... > > The issue was raised by others (e.g. on SOF > http://stackoverflow.com/questions/23925726/django-relation-django-site-does-not-exist) > > but not really solved. > > I realised that I could work around this issue by > Step 1: commenting out all of the apps that I custom built from (A) > INSTALLED_APPS and (B) urls.py > Step 2: running .manage.py migrate > Step 3: commenting my apps back in > Step 4: running .manage.py migrate > > But this doesn't seem right. None of the suggestions out there have worked > for me, including: ./manage.py migrate sites (which results in the same > error). > In fact, whatever migrate or makemigrations command I run, it all results > in the "relation "django_site" does not exist" error. > > So I came across this, where the last comms dates back less than 2 weeks > with Simon Charette taking it to the irc channel. > > https://code.djangoproject.com/ticket/24524 > > Is there any follow-up from this?
The symptoms described in the ticket do not match yours. You wrote that you're getting the error even when running makemigrations, whereas the reporter of that ticket wrote that makemigrations succeeds, but a subsequent migrate fails. >From what you described, it seems like your project tries to perform a database query on startup, which obviously will not work before you actually create the database with an up-to-date schema. It's impossible to tell with certainty without seeing the full traceback or any code, but it looks like you are trying to fetch a Site object from the database on startup (as in, one of your applications makes queries on import time). This is simply not supported, because such an operation does not make sense, when you think about it. (There's a chicken-and-egg problem in this scenario.) All in all, from your description is seems to me that there is nothing Django can do about the issue, but you'll have to provide more information in order for us to help you resolve the problem. Cheers, Michal -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160309124156.GI25061%40koniiiik.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature