Get failed when want to deploy Django project

On my local development it works perfect for make migration. When I want to deploy it it failes under process. What I read is it my category migration is failing on. I can’t understand why it fails when it working perfect locally with migration.
When I under fly.toml comment line than it deploy it.

release_command = 'python migrate --noinput'

Here is my log

  INFO [fly api proxy] listening at /.fly/api
  2024/06/07 10:57:59 INFO SSH listening listen_address=[xxxxxxxxxxx]:22 dns_server=[fdaa::3]:53
  Machine created and started in 22.588s
  Traceback (most recent call last):
    File "/code/", line 22, in <module>
    File "/code/", line 18, in main
    File "/usr/local/lib/python3.10/site-packages/django/core/management/", line 442, in execute_from_command_line
    File "/usr/local/lib/python3.10/site-packages/django/core/management/", line 436, in execute
    File "/usr/local/lib/python3.10/site-packages/django/core/management/", line 412, in run_from_argv
      self.execute(*args, **cmd_options)
    File "/usr/local/lib/python3.10/site-packages/django/core/management/", line 458, in execute
      output = self.handle(*args, **options)
    File "/usr/local/lib/python3.10/site-packages/django/core/management/", line 106, in wrapper
      res = handle_func(*args, **kwargs)
    File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/", line 117, in handle
      executor = MigrationExecutor(connection, self.migration_progress_callback)
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 18, in __init__
      self.loader = MigrationLoader(self.connection)
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 58, in __init__
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 276, in build_graph
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 198, in validate_consistency
      [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 198, in <listcomp>
      [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
    File "/usr/local/lib/python3.10/site-packages/django/db/migrations/", line 60, in raise_error
      raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
  django.db.migrations.exceptions.NodeNotFoundError: Migration blog.0002_post_categories_post_created_on_post_tags_and_more dependencies reference nonexistent parent node ('category', '0003_alter_category_id_alter_tag_id')
   INFO Main child exited normally with code: 1
   INFO Starting clean up.
   WARN could not unmount /rootfs: EINVAL: Invalid argument
  [    2.370557] reboot: Restarting system
  machine restart policy set to 'no', not restarting
Checking DNS configuration for
Error: release command failed - aborting deployment. error release_command machine 6e825d14bd4358 exited with non-zero status of 1

Found it by my self.
For others if they have same trouble.
My solution was

  1. Delete all created migrations Do not delete file leave them
  2. found out that under .venv/lib/python3.10/site-packages/category/migrations Delete all migrtations files beside
  3. run python makemigrations
  4. run python migrate