Currently I have started working on Django project given by me for learning purpose.
I have done all kind of necessary setup in my virtualenv and when running migrate command on my project I am getting below kind of dependencies problems as below.
I have tried to find solution online and django doc but clueless.
Traceback
Traceback (most recent call last):
File "manage.py", line 40, in <module>
execute_from_command_line(sys.argv)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 89, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 306, in build_graph
_reraise_missing_dependency(migration, parent, e)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 276, in _reraise_missing_dependency
raise exc
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/loader.py", line 302, in build_graph
self.graph.add_dependency(migration, key, parent)
File "/home/moon/production/remax/remax_env/lib/python3.6/site-packages/django/db/migrations/graph.py", line 126, in add_dependency
parent
django.db.migrations.exceptions.NodeNotFoundError: Migration core.0002_auto_20200408_0215 dependencies reference nonexistent parent node ('filer', '0008_auto_20200408_0215')
Snippet from migration file as below. 0002_auto_20200408_0215.py
class Migration(migrations.Migration):
dependencies = [
('filer', '0008_auto_20200408_0215'),
('sites', '0003_auto_20200408_0215'),
('core', '0001_initial'),
]
I have thought to comment dependencies lines from 0002_auto_20200408_0215.py files but my friend told me it should work without removing any lines.
Can someone pls guide me what I am doing wrong & how to solve this issue.
Thanks.
There doesn't appear to be a django-filer migration with the name mentioned 0008_auto_20200408_0215
.
https://github.com/divio/django-filer/tree/master/filer/migrations
Given that the suffix _20200408_0215
is identical to your own application's migration file -- was your migration file perhaps edited?
When you depend on migrations of external packages your application will use those shipped with the package. In a normal work flow you should not be generating migration files for other applications.
Find the latest migration available in your installed 'django-filer' application and edit your migration file to use that.
ls /usr/local/lib/python3.7/site-packages/filer/migrations/
0001_initial.py 0004_auto_20160328_1434.py 0007_auto_20161016_1055.py 0010_auto_20180414_2058.py __pycache__
0002_auto_20150606_2003.py 0005_auto_20160623_1425.py 0008_auto_20171117_1313.py 0011_auto_20190418_0137.py
0003_thumbnailoption.py 0006_auto_20160623_1627.py 0009_auto_20171220_1635.py __init__.py
You will have to check for python3.6 instead of python3.7 and you may want to check dist-packages as well as site-packages depending on your distribution and how you installed django-filer.
My test application has a models.py like this:
from django.db import models
from filer.fields.file import FilerFileField
# Create your models here.
class Myobject(models.Model):
name = models.CharField(max_length=100)
other_name = models.CharField(max_length=100)
file_field = FilerFileField(blank=True, null=True, on_delete=models.SET_NULL)
Which generates dependencies in a migration file like so:
# Generated by Django 3.0.5 on 2020-04-15 10:21
from django.db import migrations
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
dependencies = [
('filer', '0011_auto_20190418_0137'),
('testthis', '0001_initial'),
]
<snip>
If I change that dependency ('filer', '0011_auto_20190418_0137'),
at all I get your same error.
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration testthis.0002_myobject_file_field dependencies reference nonexistent parent node ('filer', '0011_auto')
Align your migration file with the latest django-filer migration available on your system.
Before migrating, type python manage.py showmigrations
and you will see all apps with their migrations (applied or not). Check if there indeed is a 'filer' app with a migration named '0008_auto_20200408_0215'. If there is not, the app might not be in your INSTALLED_APPS (project/settings.py) and you should add it, or remove the dependency from the dependencies list (although I don't recommend this)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.