Cannot Runserver After Django CircularDependencyError

Lets say you attempt a Django 1.7 migration and you get this error:


Well that sucks.

In my case, the model change was of minor importance and I did not have time to figure out how to resolve the circular dependency. So I reverted all changes and moved on. But now “runserver” fails with the circular dependency error. Somehow the error persists after the code is reverted. How does this happen?

Turns out that makemigrations creates a folder called “notmigrations” in the folder that contains your project. Delete this folder and you will be back to the initial state.



Django Makemigrations Wants to Remove an Existing Field

Django migrations are awesome. But even the docs say you should inspect the proposed migrations before running “migrate”. Recently I ran “makemigrations” and Django wanted to remove a field that was still in my model. What’s going on here?

In this case, the model had lots of fields and added @property methods. It turns out that there was a @property method that had the same name as a model field. I will not go into details about how this happened. Anyway, it turns out that the @property method was an error. Removing it and deleting the migration file fixed the problem.