On Tuesday, March 24, 2020 at 7:36:31 PM UTC+14, Yves de Champlain wrote:
HiI 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 ... OKApplying auth.0001_initial... OK
Applying auth.0002_alter_permission_
name_max_length ... OKApplying auth.0003_alter_user_email_
max_length ... OKApplying auth.0004_alter_user_username_
opts ... OKApplying auth.0005_alter_user_last_
login_null ... OKApplying auth.0006_require_
contenttypes_0002 ... OKApplying auth.0007_alter_validators_
add_error_messages ... OKApplying auth.0008_alter_user_username_
max_length ... OKApplying auth.0009_alter_user_last_
name_max_length ... OKApplying auth.0010_alter_group_name_
max_length ... OKApplying auth.0011_update_proxy_
permissions ... OKApplying user.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_
auto_add ... OKApplying admin.0003_logentry_add_
action_flag_choices ... OKApplying 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- , line 155, in get_app_configpackages/django/apps/registry. py" 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d1a4f2f5-c532-4992-b59a-934d7c1de0db%40googlegroups.com.
No comments:
Post a Comment