Hi

I added a new app 'portfolio' in my project, but since then migrations 
won't work anymore because Django seems to be trying to do them in the 
wrong order.

*Running migrations:*

Applying core.0001_initial...* OK*

Applying contenttypes.0001_initial...* OK*

Applying contenttypes.0002_remove_content_type_name...* OK*

Applying auth.0001_initial...* OK*

Applying auth.0002_alter_permission_name_max_length...* OK*

Applying auth.0003_alter_user_email_max_length...* OK*

Applying auth.0004_alter_user_username_opts...* OK*

Applying auth.0005_alter_user_last_login_null...* OK*

Applying auth.0006_require_contenttypes_0002...* OK*

Applying auth.0007_alter_validators_add_error_messages...* OK*

Applying auth.0008_alter_user_username_max_length...* OK*

Applying auth.0009_alter_user_last_name_max_length...* OK*

Applying auth.0010_alter_group_name_max_length...* OK*

Applying auth.0011_update_proxy_permissions...* OK*

Applying user.0001_initial...* OK*

Applying admin.0001_initial...* OK*

Applying admin.0002_logentry_remove_auto_add...* OK*

Applying admin.0003_logentry_add_action_flag_choices...* OK*

Applying data.0001_initial...* OK*

Applying data.0002_auto_20200306_1522...Traceback (most recent call last):

File 
"/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/apps/registry.py"
, line 155, in get_app_config

  return self.app_configs[app_label]

KeyError: 'portfolio'

During handling of the above exception, another exception occurred:

[...]

LookupError: No installed app with label 'portfolio'.


portfolio is listed in my INSTALLED_APPS :

LOCAL_APPS = (
    'core',
    'portfolio',
    'user',
    'data',
    'editor',
)

INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS + THIRD_PARTY_APPS

If I add a dependency in the problematic data.0002_auto_20200306_1522 migration 
: 

class Migration(migrations.Migration):
    dependencies = [
        ('data', '0001_initial'),
        ('portfolio', '0001_initial'),
    ]

Other errors occur :

django.db.migrations.exceptions.NodeNotFoundError: Migration 
data.0002_auto_20200306_1522 dependencies reference nonexistent parent node 
('portfolio', '0001_initial')

Traceback (most recent call last):

  File 
"/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/db/migrations/loader.py",
 
line 166, in check_key

    return self.graph.root_nodes(key[0])[0]

IndexError: list index out of range


During handling of the above exception, another exception occurred:

[...]

File 
"/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/db/migrations/loader.py",
 
line 173, in check_key

    raise ValueError("Dependency on app with no migrations: %s" % key[0])

ValueError: Dependency on app with no migrations: user

I get the same results with 'run_before'

The only way I have to make things work again is to comment out 'data' from 
INSTALLED_APPS, make migrations, remove comments and migrate again : 

Operations to perform: 
  Apply all migrations: admin, auth, contenttypes, core, portfolio, sessions
, user 
Running migrations:
  Applying core.0001_initial... OK 
  Applying contenttypes.0001_initial... OK 
  Applying contenttypes.0002_remove_content_type_name... OK 
  Applying auth.0001_initial... OK 
  Applying auth.0002_alter_permission_name_max_length... OK 
  Applying auth.0003_alter_user_email_max_length... OK 
  Applying auth.0004_alter_user_username_opts... OK 
  Applying auth.0005_alter_user_last_login_null... OK 
  Applying auth.0006_require_contenttypes_0002... OK 
  Applying auth.0007_alter_validators_add_error_messages... OK 
  Applying auth.0008_alter_user_username_max_length... OK 
  Applying auth.0009_alter_user_last_name_max_length... OK 
  Applying auth.0010_alter_group_name_max_length... OK 
  Applying auth.0011_update_proxy_permissions... OK 
  Applying user.0001_initial... OK 
  Applying admin.0001_initial... OK 
  Applying admin.0002_logentry_remove_auto_add... OK 
  Applying admin.0003_logentry_add_action_flag_choices... OK 
  Applying portfolio.0001_initial... OK 
  Applying portfolio.0002_auto_20200324_0131... OK 
  Applying sessions.0001_initial... OK 
(cert_tool) yves@C50484 passages_nds % python manage.py migrate 
Operations to perform: 
  Apply all migrations: admin, auth, contenttypes, core, data, portfolio, 
sessions, user 
Running migrations: 
  Applying data.0001_initial... OK 
  Applying data.0002_auto_20200306_1522... OK 
  Applying data.0003_auto_20200318_1722... OK



Any help would be very much appreciated !

Thanks !

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/35a5a0c6-6a6a-4cc6-bb3b-bfa28d8c273f%40googlegroups.com.

Reply via email to