Reputation: 165
I got this error ModuleNotFoundError: No module named 'django.db.migrations.migration' after i tried these below steps
python3 manage.py migrate --fake resources zero
(resources is my
app name)find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
python3 manage.py showmigrations
Note: used PostgreSQL
How to resolve this issue?
Upvotes: 3
Views: 7842
Reputation: 393
By running those commands you might have accidentally deleted the migrations module. Try reinstalling Django via pip.
pip uninstall django
pip install django
Take note of the version of Django you are using. In case you aren't using the latest version for your python environment install using the following command
pip install django==<version goes here>
Edit:-
Drop the existing database schema. Delete the migrations folder and recreate an empty one in its place.
Upvotes: 6
Reputation: 520
It seems you need to force reinstall Django in order to restore the base migrations folder.
Upvotes: 0