Django error: relation "users_user" does not exist

Prometheus :

I'm getting the following error during migration:

django.db.utils.ProgrammingError: relation "users_user" does not exist

  File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)

This is my model:

from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from ..managers.user import UserManager


class User(AbstractBaseUser, PermissionsMixin):
    # Email identifier, primary key, unique identifier for the user.
    email = models.EmailField(verbose_name='email address', max_length=254, unique=True, db_index=True)
    is_admin = models.BooleanField(default=False)
    is_active = models.BooleanField(default=False)
    objects = UserManager()

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

    class Meta:
        verbose_name = 'User'
        app_label = "users"

    def __unicode__(self):
        return self.email

    @property
    def get_full_name(self):
        return self.email

    @property
    def get_short_name(self):
        return self.email

    def has_module_perms(self, app_label):
        """
        Does the user have permissions to view the app `app_label`
        """
        # Simplest possible answer: Yes, always
        return True

    @property
    def is_staff(self):
        # Simplest possible answer: All admins are staff
        return self.is_admin

Settings:

AUTH_USER_MODEL = 'users.User'

Anything I have missed?

tgdn :

Inside your user app, you should have a folder migrations. It should only contain 0001_initial.py and __init__.py. Is that correct?

Try running ./manage.py sqlmigrate user 0001_initial and see what it does, because thats where the error comes from

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Problem with docker-compose up for django cookiecutter ->Django Error: relation "users_user" does not exist

Django + posgtres relation does not exist error

Relation does not Exist/ Programming Error in django

no such table: users_user

Django: relation does not exist

Relation does not exist error in Django after postgresql integration

Python Django - Internal Error ProgrammingError relation does not exist

relation "blog_blog" does not exist - error in Django app

relation "account_emailaddress" does not exist - django error

executing raw sql in django error: relation does not exist

Django migrations: relation does not exist

Django: Relation does not exist in Postgresql

Relation does not exist - Django & Postgres

Relation does not exist error using WITH

JPA ERROR: relation does not exist

PostgreSQL Error "ERROR: relation "user" does not exist"

ProgrammingError: relation "django_session" does not exist

ProgrammingError: relation "django_site" does not exist

PG::UndefinedTable: ERROR: relation "..." does not exist

Weird error: relation <schema name> does not exist

PostgreSQL function : relation does not exist error

PG::UndefinedTable: ERROR: relation 'caves' does not exist

PostgreSQL: Error: column of relation does not exist

Error : relation does not exist, on greenplum database

Getting 'relation "schemaversions" does not exist error'

Error on ALTER TYPE in postgres relation does not exist

PSQLException: ERROR: relation "folder" does not exist

postgresql nextval throws error relation does not exist

"relation does not seem to exist" error on Heroku