39
Your Django installation seems corrupted. You can reinstall with:
pip3 uninstall Django
pip3 install Django
Usually this happens if you installed Django in your regular operating system’s python installation and then later installed a virtualenv copy and tried to run the django server. You need to reinstall Django in your virtualenv, after removing it first if it already exists.
11
Assuming you are running in the virtual environment, you might have actually deleted the files under /django/db/migrations/ as well. So the error is obvious here. You would need to reinstall django to get the files back for successful migration.
To do this, check the django version
python -m django --version
Then install the same version using following command
pip install --upgrade --force-reinstall Django==3.2.2
- [Django]-How do I POST with jQuery/Ajax in Django?
- [Django]-Django gives Bad Request (400) when DEBUG = False
- [Django]-Django 2 – How to register a user using email confirmation and CBVs?
4
Without thinking I copy-pasted and run this oneliner in the root directory.
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
Well, I had Django installed within the venv, and – surprise surprise – there’s a migrations
package in the Django source code.
After reinstall everything works fine.
- [Django]-Modify value of a Django form field during clean()
- [Django]-Multiple tuples in unique_together
- [Django]-How to csrf_token protection in jinja2 template engine?