Django - makemigrations - No changes detected
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping
--
Chapters
00:00 Django - Makemigrations - No Changes Detected
00:33 Accepted Answer Score 563
00:52 Answer 2 Score 36
01:33 Answer 3 Score 110
02:06 Answer 4 Score 95
03:38 Thank you
--
Full question
https://stackoverflow.com/questions/3615...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangomigrations
#avk47
ACCEPTED ANSWER
Score 563
To create initial migrations for an app, run makemigrations and specify the app name. The migrations folder will be created.
./manage.py makemigrations <myapp>
Your app must be included in INSTALLED_APPS first (inside settings.py).
ANSWER 2
Score 110
My problem (and so solution) was yet different from those described above.
I wasn't using models.py file, but created a models directory and created the my_model.py file there, where I put my model. Django couldn't find my model so it wrote that there are no migrations to apply. 
My solution was: in the my_app/models/__init__.py file I added this line:
from .my_model import MyModel
ANSWER 3
Score 95
There are multiple possible reasons for django not detecting what to migrate during the makemigrations command.
- migration folder You need a migrations package in your app.
 - INSTALLED_APPS You need your app to be specified in the 
INSTALLED_APPS.dict - Verbosity  start by running 
makemigrations -v 3for verbosity. This might shed some light on the problem. - Full path In 
INSTALLED_APPSit is recommended to specify the full module app config path 'apply.apps.MyAppConfig' - --settings you might want to make sure the correct settings file is set: 
manage.py makemigrations --settings mysite.settings - specify app name explicitly put the app name in 
manage.py makemigrations myapp- that narrows down the migrations for the app alone and helps you isolate the problem. model meta check you have the right
app_labelin your model metaDebug django debug django core script. makemigrations command is pretty much straight forward. Here's how to do it in pycharm. change your script definition accordingly (ex:
makemigrations --traceback myapp)
Multiple databases:
- Db Router when working with django db router, the router class (your custom router class) needs to implement the 
allow_syncdbmethod. 
makemigrations always creates migrations for model changes, but if allow_migrate() returns False,
ANSWER 4
Score 36
I've read many answers to this question often stating to simply run makemigrations in some other ways. But to me, the problem was in the Meta subclass of models.
I have an app config that says label = <app name> (in the apps.py file, beside models.py, views.py etc). If by any chance your meta class doesn't have the same label as the app label (for instance because you are splitting one too big app into multiple ones), no changes are detected (and no helpful error message whatsoever). So in my model class I have now:
class ModelClassName(models.Model):
    class Meta:
        app_label = '<app name>' # <-- this label was wrong before.
    field_name = models.FloatField()
    ...
Running Django 1.10 here.