Problem
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency account.0001_initial on database 'default'.
So we can migrate database without admin(admin.0001_initial) firstly.
After its dependency migrated, execute commands to migrate admin.0001_initial
.
Solution
- remove 'django.contrib.admin' from INSTALLED_APPS in settings.py.
- execute commands:
Python manage.py makemigrations appname
Python manage.py migrate appname
- add 'django.contrib.admin' to INSTALLED_APPS in settings.py file.
- execute commands again:
$: Python manage.py makemigrations appname
$: Python manage.py migrate appname
For me removing 'django.contrib.admin' from INSTALLED_APPS and running makemigrations results in
LookupError: No installed app with label 'admin'.
go to urls.py and comment out urls with admin