django makemigrations not detecting new model

I encountered similar issue ("No changes detected" when adding new models) when using Django 1.11, and solved by importing the new models (actually better to import all models) in the __init__.py in models package:

from .student import Student
from .teacher import Teacher

It's written here:

  • https://docs.djangoproject.com/en/1.11/topics/db/models/#organizing-models-in-a-package

I've met this problem during development and this combination helps me:

python manage.py makemigrations mymodule

This command create migrations for the specific module. It should be in INSTALLED_APPS, but you'll get warning if it's not in there.

python manage.py migrate

Also, mention answer by xiaohen, I've create packages with PyCharm, so I've got init.py file by default.

Tags:

Python

Django