[Answered ]-Exception when migrating custom User in Django

1👍

You should not delete your migration folder. If you do that, django won’t make migrations for you. Create migrations folder in your core app, create an empty __init__.py file inside it, remove your db.sqlite3 file, run ./manage.py makemigrations, and then migrate should work perfectly.

1👍

Mehdi Pourfar’s answer is correct.If you want to know more details

By running makemigrations, you’re telling Django that you’ve made some changes to your models (in this case, you’ve made new ones) and that you’d like the changes to be stored as a migration.

Migrations are how Django stores changes to your models (and thus your database schema) – they’re just files on disk. You can read the migration for your new model if you like; it’s the file polls/migrations/0001_initial.py. Don’t worry, you’re not expected to read them every time Django makes one, but they’re designed to be human-editable in case you want to manually tweak how Django changes things.

Tell django which app you want to make migrations all fix your problem.It will auto create a folder call migrations keep your model’s record.

python manage.py makemigrations core

Leave a comment