Why is Django still creating deleted model migration files?

We have made modifications to our models and are encountering unexpected errors. We deleted our databases and recreated them, as well as the ‘pycache’ and ‘migrations’ folders. We then recreated the migrations folder in each app with an ‘init.py’ file. However, when we ran ‘makemigrations’ in Django, it still created old model migration files, specifically in ‘0002_initial.py’, even though those models were nowhere to be found. We also tried deleting the database and recreating it with a different name, but we still encountered errors related to mismatched relations.

We have tried everything, including resetting all, fake migrating, zero attempts, restarting the PC, running in another text editor, and shutting down the PC. However, we are still encountering the same problem.

I believe that there may be a bug in Django that needs to be fixed, as we have also raised many issues in the community, but have not received any solutions.

still, refer to the modified model name.:


For more reference, regarding our problem related to this event, that guy did not get any solution too: Resetting migrations

Side note: Please do not post images of code, errors, or terminal output here. When needing to share such information, copy / paste the code (etc) into the body of your post, and enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. (This forces the forum software to keep your code properly formatted.)

I’m willing to guarantee that you’ve missed some reference somewhere among all this. Either a setting, something in an apps.py file, a hanging reference, something.

Unfortunately, given the rather vague nature of this issue, it’s going to be highly unlikely for us to diagnose this without seeing significant portions of your project - if not the complete project. If you can share the entire project on a public repo, I’d be happy to take a look at it. But without significantly more information, I’m not sure we’d be able to help.

Also, it would help if you identified what versions of Django and Python you are using, along with any other significant third-party libraries that are part of your project.