As the title says, I can\'t seem to get migrations working.
The app was originally under 1.6, so I understand that migrations won\'t be there initially, and indeed i
You want to check the settings.py
in the INSTALLED_APPS
list and make sure all the apps with models are listed in there.
Running makemigrations
in the project folder means it will look to update all the tables related to all the apps included in settings.py
for the project. Once you include it, makemigrations
will automatically include the app (this saves a lot of work so you don't have to run makemigrations app_name
for every app in your project/site).
Just in case you have a specific field that does not get identified by makemigrations: check twice if you have a property with the same name.
example:
field = django.db.models.CharField(max_length=10, default = '', blank=True, null=True)
# ... later
@property
def field(self):
pass
the property will "overwrite" the field definition so changes will not get identified by makemigrations
Added this answer because none of other available above worked for me.
In my case something even more weird was happening (Django 1.7 Version), In my models.py I had an "extra" line at the end of my file (it was a blank line) and when I executed the python manage.py makemigrations
command the result was: "no changes detected".
To fix this I deleted this "blank line" that was at the end of my models.py file and I did run the command again, everything was fixed and all the changes made to models.py were detected!
You may need to fake the initial migrations using the command below
python manage.py migrate --fake-initial
In my case I needed to add my model to the _init_.py file of the models folder where my model was defined:
from myapp.models.mymodel import MyModel