Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

python - Django 1.8 RC1: ProgrammingError when creating database tables

I'm using AbstractBaseUser for my user models in various projects. Updating to Django 1.8 RC1 works smoothly and I can run the migrate management command. However, when trying to create a fresh database table layout from scratch, I get the following error:

python manage.py migrate
>>> ...
>>> ...
>>> django.db.utils.ProgrammingError: relation "auth_group" does not exist

All works perfectly with Django 1.7.x and I cannot find anything about this issue elsewhere. So, is it a big with the RC1 version or did something change that I'm not aware of in Django 1.8? Unfortunately, the error message doesn't really help ... but I'm pretty sure it has to do with the automatic migrations that come with the new Django version.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To copy the answer I got from the Django ticket mentioned above: Before calling "python manage.py migrate" to create the database layout, one needs to create a migration for the app that contains the custom user class:

python manage.py makemigrations appname

This creates a migration file within the app directory - et voilà, migrate does work and creates the other tables.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...