django.db.utils.OperationalError: no such table: user_user

2,506 views
Skip to first unread message

cyril moreau

unread,
Mar 7, 2019, 1:01:10 PM3/7/19
to Django users
Hi,

I have the following model that i use as AUTH_USER_MODEL :

model.py


class User(AbstractBaseUser, PermissionsMixin):
   email = models.EmailField(_('email address'), unique=True)
   password = models.CharField(_('password'), max_length=255, blank=False)
   first_name = models.CharField(_('first name'), max_length=30, blank=True)
   last_name = models.CharField(_('last name'), max_length=30, blank=True)
   date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)
   is_active = models.BooleanField(_('active'), default=True)
   is_staff = models.BooleanField(_('staff status'), default=False)
   avatar = models.CharField(_('avatar'), max_length=30, blank=True, null=True)
    #models.ImageField(upload_to='avatars/', null=True, blank=True)

    objects = UserManager()

    USERNAME_FIELD = 'email'
   REQUIRED_FIELDS = []

    class Meta:
       verbose_name = _('user')
       verbose_name_plural = _('users')

settings.py
AUTH_USER_MODEL = 'user.User'


When i want to create a superuser and enter the email of the user i want to create :
python manage.py createsuperuser


I get the following error : 
django.db.utils.OperationalError: no such table: user_user

Someone knows why I get this error?

Thank you for you help

cyril moreau

unread,
Mar 7, 2019, 3:57:35 PM3/7/19
to Django users
To fix my issue I had to makemigrations for each one of my app :

by doing the following it will create my user table :

python manage.py  makemigrations user

does not work if i just do :
python manage.py  makemigrations


Best regards

Nasir Ahmad

unread,
Mar 8, 2019, 7:42:44 AM3/8/19
to django...@googlegroups.com
Hi,
Migration for each app use cmd > python manage.py migrate, it migrate all inbuilt app.

--
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...@googlegroups.com.
To post to this group, send email to django...@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/cfca6c60-4626-470c-afa3-5213862e4dfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

cyril moreau

unread,
Mar 8, 2019, 8:10:26 AM3/8/19
to Django users
It does not work for me and i dont know why.

if i want to have the table created I have to first make :
python manage.py  makemigrations my_app

and then 
python manage.py  migrate


python manage.py  makemigrations (without the name of my app) does not take into account my apps that i have define in the settings.py file :
INSTALLED_APP=[
django.contrib.admin,
....
user,
event,
picture,
....
]
I can not explain this issue.
Reply all
Reply to author
Forward
0 new messages