Kamran Hosseini
Kamran Hosseini

Reputation: 536

error while using makemigration in django

I am working on a development server running python3.5 and Django 1.11 with virtualenv

when I use "python manage.py makemigrations" I get this error

Traceback (most recent call last): File "manage.py", line 8, in <module> from django.core.management import execute_from_command_line File "/opt/hafez_bot/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 13, in <module> from django.core.management.base import ( File "/opt/hafez_bot/env/lib/python3.5/site-packages/django/core/management/base.py", line 17, in <module> from django.db.migrations.exceptions import MigrationSchemaMissing File "/opt/hafez_bot/env/lib/python3.5/site-packages/django/db/migrations/__init__.py", line 1, in <module> from .migration import Migration, swappable_dependency # NOQA ImportError: No module named 'django.db.migrations.migration'

please help me


I understood that it's about my "manage.py" file and it has nothing to do with migration. because the "python manage.py help" raises the same error

this is my "pip freeze" output:

certifi==2017.7.27.1
Django==1.11.6
djangorestframework==3.6.4
future==0.16.0
mysqlclient==1.3.12
python-telegram-bot==8.0
pytz==2017.2

Upvotes: 2

Views: 1708

Answers (3)

Shashi Ranjan
Shashi Ranjan

Reputation: 422

Sometimes to remove the *.pyc files, people use the following command:

find . -path "*/migrations/*.py" -not -name "__init__.py" -delete

This will delete the migrations folder in the ./venv folder as well if venv folder happens to be inside the current folder.

Move venv folder to somewhere else.

Upvotes: 0

Kamran Hosseini
Kamran Hosseini

Reputation: 536

I removed Django and I reinstalled it. And the error fixed

Upvotes: 5

Muema
Muema

Reputation: 302

I learned a hard lesson and a valuable lesson as well, any time you might face a challenge raised by django with a line at the bottom that has the following component ImportError: No module named 'django.db.migrations.migration' it would be good for you to note that django did not install well. So you will be forced to re-install django again so that all model migration files can be availed for migration.

Upvotes: 0

Related Questions