I am making a web app (I am a student and this is my first attempt of building a project) using stack: Django, Vue and MySQL. Attaching link to git repo here: https://github.com/yeshapan/LearningDashboard (please refer ReadME for details)
I completed initial setup and then created an app called dashboard where I defined models for the features.
Edit: Here’s the error message as text:
Traceback (most recent call last):
File "C:UsersDELLDesktopLearningDashboardmanage.py", line 22, in <module>
main()
File "C:UsersDELLDesktopLearningDashboardmanage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagement__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagement__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagementbase.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagementbase.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagementbase.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangocoremanagementcommandsmigrate.py", line 121, in handle
executor.loader.check_consistent_history(connection)
File "C:UsersDELLDesktopLearningDashboardvenvLibsite-packagesdjangodbmigrationsloader.py", line 327, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency dashboard.0001_initial on database 'default'.
However, it is raising error:
Error message
I tried asking ChatGPT for help.
It said to delete everything in dashboard/migrations and delete db.sqlite3 file in root folder (Edit: I also deleted the table from MySQL and applied migrations again but it is still giving error) and apply migrations again. I did so but it keeps showing the same error. Please guide me how am I supposed to solve this error??
NOTE:
(Also, since this is my first project ever and I only know the basics of python and MySQL) and I’m learning everything else as I go, so any advice in general would be really helpful and much appreciated
Yesha Pandya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Be careful whilst following chatgpt’s advice. It is not a good idea to delete migration files. However since you’ve already done that, and it’s difficult to tell what exactly you deleted and also since you’re in development, I would suggest you drop the database, delete all migration files and run:
python manage.py makemigrations
followed by
python manage.py migrate
See https://forum.djangoproject.com/t/django-db-migrations-exceptions-inconsistenmigrationhistory/14129