26π
If you open the migration file products.0002_auto_20160618_1143
you will see a section called dependencies:
dependencies = [("products", "0001_initial")]
Which will look like that. This line tell Django that the current file depends on that file. A file that given that error message isnβt there. You can try commenting out that line and running the command again. Be aware that if one file is missing itβs possible many are missing so you should reconcile your dependencies with what files you actually have.
DISCLAIMER: If this is a production DB messing around with migration files can be dangerous if you donβt know what you are doing. You should test this on a staging or dev server first (preferably one that has a snapshot you can restore to).
5π
If it not solve after reseting the migrations, follow the following steps:
Apparently django kept migration files within itβs own module folder. This is why you need to flush the django:
- pip uninstall django.
- /Lib/site-packages, deleted django folder.
- Deleted all *.pyc files in my project.
- Deleted all pycache folders in my project.
- Cleared all migrations folders in my project (keep init.py).
- pip install django==x.x.x.
- python manage.py migrate.
- python manage.py makemigrations <app_name>.
- python manage.py migrate.
- python manage.py runserver.
Now your problem will be solved.
- [Django]-How to include templates dynamically in Django using "include" tag
- [Django]-Is there a function for generating settings.SECRET_KEY in django?
- [Django]-Does Django queryset values_list return a list object?
4π
If you have not any serious data in your database, you can simply reset your migrations, as itβs been explained here.
- [Django]-Can I use HTTP Basic Authentication with Django?
- [Django]-WARNING Not Found: /favicon.ico in Django
- [Django]-Coverage.py warning: No data was collected. (no-data-collected)
0π
Delete the file product.0002_auto_20160618_1143 migration file.
and again run the following commands:
1.python manage.py makemigrations.
2.python manage.py migrate.
- [Django]-Losslessly compressing images on django
- [Django]-How to use django models with foreign keys in different DBs?
- [Django]-Django like framework for Java
0π
If you have dangling dependency to 0002_auto_20160618_1143
in a file created by makemigrations
command and file does not exist then, please remove this reference from that file. Remember to to remove migration from django_migrations
table as well. That fixed my issue
dependencies = [
('workspace', '0002_auto_20160618_1143'),
('datasets', '0001_initial'),
]
- [Django]-How to monkey patch Django?
- [Django]-Auto-populating created_by field with Django admin site
- [Django]-How to set a Django model field's default value to a function call / callable (e.g., a date relative to the time of model object creation)
0π
If you recently deleted an app and trying the migrations. Then better :
Delete the file product.0002_auto_20160618_1143 migration file.
and again run the following commands:
1.python manage.py makemigrations.
2.python manage.py migrate. delete
Also you can follow the most rated comment. But commentate the newly deleted app name from dependencies. Donβt commentate the whole dependencies.
- [Django]-Negating a boolean in Django template
- [Django]-Django The 'image' attribute has no file associated with it
- [Django]-Django template system, calling a function inside a model