I am unable to migrate my django after running python ./manage.py migrate.
This is what showmigrations is displaying
customerweb
[X] 0001_initial
[X] 0002_user_industry
[X] 0003_auto_20220209_1737
[X] 0004_userconfiguration_night_surcharge_exempt
[ ] 0005_auto_20220614_1100
[X] 0006_orderdelivery_is_order_unique
[ ] 0007_orderdelivery_client_reference_no
I have tried --fake as well as trying to move back by one migrate using
python ./manage.py migrate <app_name> <000x_migrate_file>
all these is not working as the exeception keeps prompting InconsistentMigrationHistory. I have tried deleting the migration folders as well (keeping init only) but does not work as well.
CodePudding user response:
So Django admin expects a default auth model which is AUTH_USER_MODEL
. Admin app apply migration as django's auth model Now since you changes the dependency hence the error. Please follow the below steps
- Take a backup of your database
- Comment out your created app in
INSTALLED_APPS
andAUTH_USER_MODEL = 'account.User'
in yoursettings.py
in project folder - Run
python manage.py admin zero
- Uncomment lines commented in step 2
- Run
python manage.py migrate