Hi! I’m building a website that uses Django as the backend and React.js as the frontend. I have an pre-existing database that I linked to my Django project. I then created the apps and generated the models for each app by using the inspectdb
command. Finally I ran the makemigrations
and migrate --fake
commands and everything worked well. Recently I have decided to add user authentication to the website and I wanted to create the model for the app user_management
where I would create the table for users. When I ran makemigrations
, everything looked fine but when I ran the migrate
command, I got the error in the title:
django.db.utils.ProgrammingError: (1146, “Table ‘databasename.django_content_type’ doesn’t exist”)
This is what my settings.py looks like:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'corsheaders',
...
]
From what I understand, the issue is because the table django_content_type
was not created when I first ran the migrate
command.
Is there a way to fix this?