Friday, March 8, 2019

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

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.


Le vendredi 8 mars 2019 13:42:44 UTC+1, Nasir Ahmad a écrit :
Hi,
Migration for each app use cmd > python manage.py migrate, it migrate all inbuilt app.

On Fri, Mar 8, 2019 at 2:27 AM cyril moreau <cyril....@gmail.com> wrote:
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

Le jeudi 7 mars 2019 19:01:10 UTC+1, cyril moreau a écrit :
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

--
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.

--
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+unsubscribe@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/dc949cde-24b4-42af-9472-447917f35f71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment