Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python-ModuleNotFoundError: No module named 'django.db.migrations.migration'

I got this error ModuleNotFoundError: No module named 'django.db.migrations.migration' after i tried these below steps

  1. python3 manage.py migrate --fake resources zero (resources is my app name)
  2. find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
  3. find . -path "*/migrations/*.pyc" -delete
  4. python3 manage.py showmigrations

Note: used PostgreSQL

How to resolve this issue?

like image 622
priyanka priya Avatar asked Nov 25 '25 10:11

priyanka priya


1 Answers

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.

like image 138
Paras Jain Avatar answered Nov 27 '25 01:11

Paras Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!