68๐
Solution โ 1
Remove pyc
files from your migrations folder.
Solution โ 2
Need to remove that reference from testBolt.0001_initial
by editing migration file.
Solution โ 3
-
Remove the new changes from the models and run
python manage.py migrate --fake
-
Now again modify your models with new changes
-
Run
python manage.py makemigrations
-
And then again run
python manage.py migrate
15๐
In my case, I had the .py
extension in the dependency module name, like this:
dependencies = [
('dashboard', '0003_auto_20181024_0603.py'),
('auth', '__latest__'),
('contenttypes', '__latest__'),
]
I removed the .py
, changing the line to this
('dashboard', '0003_auto_20181024_0603'),
and that fixed it.
- [Django]-What's the best way to extend the User model in Django?
- [Django]-Python + Django page redirect
- [Django]-With DEBUG=False, how can I log django exceptions to a log file
10๐
I had the same problem. In my case, because I played with migrations manually, I forgot to create __init__.py
inside of migrations
folder.
- [Django]-Django.db.migrations.exceptions.InconsistentMigrationHistory
- [Django]-Django get objects not referenced by foreign key
- [Django]-Django: Safely Remove Old Migrations?
9๐
This works for me
In your app migrations folder
- Delete all the files pyc in your app folder (except the
__init__
) -
Delete all the files in the migrations (except the
__init__
) -
python manage.py makemigrations
python manage.py migrate
runserver
- [Django]-How can I access environment variables directly in a Django template?
- [Django]-How can I set two primary key fields for my models in Django?
- [Django]-Django dynamic model fields
5๐
I had a similar case, running django in windows in a virtual env. In my case the missing dependency was 0001_initial โ which was definitely there in the migration folder.
The โsolutionโ was to remove the pyc files and do another migrate attempt.
- [Django]-How to dynamically compose an OR query filter in Django?
- [Django]-"<Message: title>" needs to have a value for field "id" before this many-to-many relationship can be used.
- [Django]-Django.db.migrations.exceptions.InconsistentMigrationHistory
5๐
Hereโs how it worked for me:
- Deleted all the
__pycache__
folders inside every app. - Deleted all the files inside the migration folder except for
__init.py__
inside each app folder. python manage.py makemigrations
python manage.py migrate
python manage.py runserver
- [Django]-How to put comments in Django templates?
- [Django]-How do you Serialize the User model in Django Rest Framework
- [Django]-Django: Fat models and skinny controllers?
4๐
I tried NIKHILโs solutions with no luck. What did work for me was:
- Removing my virtual environment
- Deleting the migration
__pycache__
folders - Deleting old migrations
- Recreating my virtual environment
- Running migrations
- [Django]-Update to Django 1.8 โ AttributeError: django.test.TestCase has no attribute 'cls_atomics'
- [Django]-Readonly models in Django admin interface?
- [Django]-Annotating a Sum results in None rather than zero
4๐
KeyError: u"Migration testBolt.0001_initial dependencies reference nonexistent parent node (u'delivery_boy', u'0004_auto_20150221_2011')"
Remove
testBolt.0001_initial
then run migrate again
- [Django]-Django SUM Query?
- [Django]-Django.contrib.gis.db.backends.postgis vs django.db.backends.postgresql_psycopg2
- [Django]-TransactionManagementError "You can't execute queries until the end of the 'atomic' block" while using signals, but only during Unit Testing
- [Django]-How do you dynamically hide form fields in Django?
- [Django]-Django 1.8 Run a specific migration
- [Django]-Django.db.utils.ProgrammingError: relation "bot_trade" does not exist
3๐
This worked for me:
- Delete environment.
- Crearte new environment with all dependencies
- [Django]-Django Rest Framework with ChoiceField
- [Django]-Django migration fails with "__fake__.DoesNotExist: Permission matching query does not exist."
- [Django]-Django JSONField inside ArrayField
2๐
I had moved around my virtual environment folder.so I moved it back where it was, worked for me.
- [Django]-Setting Django up to use MySQL
- [Django]-Creating a JSON response using Django and Python
- [Django]-Django won't refresh staticfiles
1๐
I just uninstalled Django and reinstalled it:
pip3 uninstall Django
pip3 install Django
then migrated
- [Django]-Deploying Django with gunicorn and nginx
- [Django]-Negating a boolean in Django template
- [Django]-Automated django receive hook on server: respond to collectstatic with "yes"
0๐
There could be some migration files remaining in the app when you tried the migrate command. First remove all migrations
directories from all the modules. For other cases Nikhil Rane has covered it all.
- [Django]-Django Model Fields Indexing
- [Django]-Specifying a mySQL ENUM in a Django model
- [Django]-How to check whether the user is anonymous or not in Django?
0๐
This works for me:
- Remove the current virtual environment and create your new virtual environment.
- Run this command in the project directory to remove all migration files โ
find . -type d -name "__pycache__" -exec rm -rf "{}" \;
- Remove database file
.sqlite3
- Now run the migrations using:
python manage.py makemigrations
- Migrate the migrations:
python manage.py migrate
Basically, all the below steps are common and I think all have gone through these steps but if youโre missing the first step i.e., to recreate the virtual environment then must give a try to it.
- [Django]-Convert seconds to hh:mm:ss in Python
- [Django]-Django South โ table already exists
- [Django]-Navigation in django
-2๐
Go to folder testBolt -> migrations and remove 0001_initial py and pyc files.
- [Django]-Django proxy model and ForeignKey
- [Django]-Django: using <select multiple> and POST
- [Django]-Location of Django logs and errors