0
votes

I am having DJango migrations problem while making migration following error is coming.

enter image description here

enter image description here

enter image description here

When I run my applications using python manage.py runserver it shows this :-

enter image description here

However, running python manage.py makemigrations shows no changes detected And Above three images are result after running python manage.py migrate. What is the problem with this?

2

2 Answers

0
votes

looks like you changed the database or migration files manually. try to re-create the database.

  1. delete the DB file
  2. delete all migrations files (keep the init file)
  3. run create migrations command
  4. run migrate command
0
votes

When the *table> already exists Error happens, it is usually due to deleting and rerunning the initial migration or models.py file. For these scenarios,

python manage.py makemigrations <app_name>
python manage.py migrate --fake-initial <app_name>

Or if you want to fake only one migration file

python manage.py migrate <migration_file_number> --fake <app_name>

--fake-initial tells Django to mark initial migration as migrated without actually running its corresponding SQL.

Django's migration document may be helpful