django - Syncdb error when creating CustomUser -
the issue create custom user:
class customuser(abstractuser): mobile = models.charfield(max_length=16) address = models.charfield(max_length=100) and in settings.py write this:auth_user_model = 'login.customuser' , when run manage.py syncdb first time(when db doesn't contains tables), throws error: django.db.utils.programmingerror: relation "auth_group" not exist when run manage.py syncdb when db tables exist, it's okay, create additional tables. what's wrong run when db doesn't contain tables?
try this
- create
migrationdirectory in directory of app containing custom user model. - create empty
__init__.pyfile insidemigrationdirectory. - execute
./manage.py makemigrations. - execute
./manage.py migrate.
i think when use custom user model, need create migrations. besides, syncdb deprecated , removed in django 1.9 it's better start using ./manage.py migrate command.
Comments
Post a Comment