Elian
Elian

Reputation: 125

Django not creating table for custom user

I've been trying to create a custom user to store extra fields in Django, but after specifying the new User and deleting the old database, Django does not want to make a table or any migrations for my app "accounts"

Error (when doing anything user related e.g. logging in):

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

Auth User Model in settings.py:

AUTH_USER_MODEL = 'accounts.User'

Installed apps:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
'forum',
]

accounts/models.py:

from django.contrib.auth.models import AbstractUser
from django.db import models


class User(AbstractUser):
    pass

Edit: I apologize, I forgot to mention. I have run makemigrations and migrate. Makemigrations returns "No changes detected." Migrate does everything but any models existing in my accounts/models.py

Upvotes: 0

Views: 1333

Answers (1)

Elian
Elian

Reputation: 125

Turns out I had to specifically run "makemigrations accounts". Not sure why, but it worked.

Upvotes: 1

Related Questions