auth_user error with Django 1.8 and syncdb / migrate

前端 未结 8 916
独厮守ぢ
独厮守ぢ 2021-01-31 14:03

When upgrading to Django 1.8 (with zc.buildout) and running syncdb or migrate, I get this message:

django.db.utils.ProgrammingError: relation \"auth_user\" does no

相关标签:
8条回答
  • 2021-01-31 15:08

    This problem is contained by running "makemigrations" for all apps, that have not yet been migrated, i.e. apps that do not yet have an "initial_0001.py" file in their migrations directory.

    This is done (in our case we use a makefile) by running for each of these apps:

    manage.py makemigrations app_name
    

    Once that is done, you can execute:

    manage.py migrate
    

    as usual.

    The underlying cause for this is that for some reason

    manage.py makemigrations
    

    does not always create these initial migrations if they are not already there. And that leads to the mentioned error.

    On the contrary,

    manage.py makemigrations app_name
    

    does always create them (if not already there). Unfortunately I cannot fathom the reasons for this asymmetry.

    0 讨论(0)
  • 2021-01-31 15:09

    Maybe you have found the answer and resolved the problem, but I wanted to point out that, in my case, the above problem was solved by dropping the database and re-creating it again, with the full privileges of the users. I was able to do this because I'm working on a non-production environment, but doing this on a staging environment is not a good idea, so be careful.

    Im using python 2.7.12 and following are the specifications of my virtualenv:

    Django==1.10.5
    django-crispy-forms==1.6.1
    django-registration-redux==1.4
    djangorestframework==3.5.3
    olefile==0.44
    packaging==16.8
    Pillow==4.0.0
    psycopg2==2.6.2
    
    0 讨论(0)
提交回复
热议问题