I’m getting the following error during migration:
django.db.utils.ProgrammingError: relation “users_user” does not exist
JavaScript
x
9
1
File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
2
return super(CursorDebugWrapper, self).execute(sql, params)
3
File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
4
return self.cursor.execute(sql, params)
5
File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
6
six.reraise(dj_exc_type, dj_exc_value, traceback)
7
File "/Users/user/Documents/workspace/api/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
8
return self.cursor.execute(sql)
9
This is my model:
JavaScript
1
42
42
1
from django.db import models
2
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
3
from ..managers.user import UserManager
4
5
6
class User(AbstractBaseUser, PermissionsMixin):
7
# Email identifier, primary key, unique identifier for the user.
8
email = models.EmailField(verbose_name='email address', max_length=254, unique=True, db_index=True)
9
is_admin = models.BooleanField(default=False)
10
is_active = models.BooleanField(default=False)
11
objects = UserManager()
12
13
USERNAME_FIELD = 'email'
14
REQUIRED_FIELDS = []
15
16
class Meta:
17
verbose_name = 'User'
18
app_label = "users"
19
20
def __unicode__(self):
21
return self.email
22
23
@property
24
def get_full_name(self):
25
return self.email
26
27
@property
28
def get_short_name(self):
29
return self.email
30
31
def has_module_perms(self, app_label):
32
"""
33
Does the user have permissions to view the app `app_label`
34
"""
35
# Simplest possible answer: Yes, always
36
return True
37
38
@property
39
def is_staff(self):
40
# Simplest possible answer: All admins are staff
41
return self.is_admin
42
Settings:
JavaScript
1
2
1
AUTH_USER_MODEL = 'users.User'
2
Anything I have missed?
Advertisement
Answer
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