I was about to package my Django app and publish the first version on my server.
Build my docker container and run my compose-file.
Migration error
When the app was starting I got a migration error:
curated-app | Traceback (most recent call last):
curated-app | File "/code/manage.py", line 22, in <module>
curated-app | main()
curated-app | File "/code/manage.py", line 18, in main
curated-app | execute_from_command_line(sys.argv)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
curated-app | utility.execute()
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
curated-app | self.fetch_command(subcommand).run_from_argv(self.argv)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
curated-app | self.execute(*args, **cmd_options)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
curated-app | output = self.handle(*args, **options)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 98, in wrapped
curated-app | res = handle_func(*args, **kwargs)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 108, in handle
curated-app | executor = MigrationExecutor(connection, self.migration_progress_callback)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__
curated-app | self.loader = MigrationLoader(self.connection)
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 58, in __init__
curated-app | self.build_graph()
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 276, in build_graph
curated-app | self.graph.validate_consistency()
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency
curated-app | [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in <listcomp>
curated-app | [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
curated-app | File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 60, in raise_error
curated-app | raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
curated-app | django.db.migrations.exceptions.NodeNotFoundError: Migration self_hosted_apps.0005_apppage_logo_svg dependencies reference nonexistent parent node ('wagtailsvg', '0005_alter_svg_file')
So I checked for the migration files which had these mentioned:
wagtailsvg', '0005_alter_svg_file
.
I have removed all migrations and created a new one, but still the same problem.
I am using the package wagtailsvg ¡ PyPI
My understanding now is that a migration from that package itself is missing but I am not sure on that part.
I looked on the repo and the 5th migration file is not available:
wagtailsvg/wagtailsvg/migrations at master ¡ Aleksi44/wagtailsvg ¡ GitHub
One of my not working migrations.
# Generated by Django 4.0.6 on 2022-07-30 20:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailsvg', '0005_alter_svg_file'),
('self_hosted_apps', '0005_apppage_logo_svg'),
]
operations = [
migrations.RemoveField(
model_name='apppage',
name='date',
),
migrations.AlterField(
model_name='apppage',
name='logo_svg',
field=models.ForeignKey(blank=True, help_text='SVG', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailsvg.svg'),
),
]
The odd thing is. My local setup does not have that problem.
But the database is also older than the newly created production setup.
Questions
Is my assumption correct?
If not what do I need to do to solve the problem?