Today I wanted to add some functionality to my Blog and fill in the tests, however, the first step in creating a test database would not pass, so I tried to solve the problem.
When running . / test, a database is first created for testing, and that's when I ran into a problem:
ValueError: Related model '' cannot be resolved
This error means that the Model in question cannot be resolved.
Then because . / test didn't print out any other useful information at all, and I didn't know where the error was occurring, I came up with the idea of trying to manually create a database, called test, and migrate it:
./ migrate --database test
Once I ran it, I finally got detailed output and located the specific Migration that was in error. it turned out to be a Model dependency for one of my Apps, but I couldn't find it. What is the reason for this?
I tried to move the order of telegrambot to the front in the INSTALLED_APPS, but that didn't work either. So I had to enable *.
It turns out that my dependencies for Migration for that App didn't depend on telegrambot, so naturally I wouldn't look for it.
So took the original, added a line for dependency, and tried . / test, problem solved.
class Migration(): dependencies = [ + ('telegrambot', '0001_initial'), ('powernews', '0004_applenews'), ]
To summarize: Some command line tools will not have much useful output when they execute errors, so you can try to perform some operations manually.
This is the whole content of this article.