'django.db.migrations.exceptions.NodeNotFoundError while upgrading django
I am upgrading my django project from django1.5
to django1.11.10
. while upgrading when I run ./manange.py migrate
I am getting django.db.migrations.exceptions.NodeNotFoundError
django.db.migrations.exceptions.NodeNotFoundError: Migration account.0004_auto_20180419_1309 dependencies reference nonexistent parent node (u'admin', u'0003_advertisements_alignedcourses_api_integration_appreciation_certificate_company_company_types_contrib')`enter code here`
This is my project structure
admin/apps.py
class AdminConfig(AppConfig):
name = 'apps.admin'
label = 'admin_app'
account/apps.py
class AccountConfig(AppConfig):
name = 'account'
label = 'account_app'
And I have added meta property for all admin models
class Meta:
'''
Meta properties for this model
'''
app_label = 'admin_app'
I could not find any migration files from my project and I followed some of the solution which I found in internet.
django.db.migrations.exceptions.NodeNotFoundError Migration authentication nonexistent parent node
Can't get rid of "nonexistent parent node" in django 1.11
I reinstalled django.Deleted all .pyc
files. deleted all migrations files. Still I am getting the same error.Please help me and can you please explain why it is happening?
Solution 1:[1]
Probably you have apps with the same name - your own app called admin
and django.contrib.admin
. No mater what is the full python path to the app final part is important part and need to be unique across the project.
You can try to change the label
of the AppConfig
of your applications which conflict with django's or other 3th party apps.
Look at the Django docs https://docs.djangoproject.com/en/1.11/ref/applications/#django.apps.AppConfig.label
AppConfig.label
Short name for the application, e.g. 'admin'
This attribute allows relabeling an application when two applications have conflicting labels. It defaults to the last component of name. It should be a valid Python identifier.
It must be unique across a Django project.
and in the Django's source code https://github.com/django/django/blob/stable/1.11.x/django/apps/config.py#L31-L34
# Last component of the Python path to the application eg. 'admin'.
# This value must be unique across a Django project.
if not hasattr(self, 'label'):
self.label = app_name.rpartition(".")[2]
Solution 2:[2]
okay i found the answers chances are u guys are using venv(python virtual enviroment) please delete that folder and delete all your migrations folder...
After u done that create a new venv and install all ur stuff and run ur usual migration commands
Solution 3:[3]
Hello there i just ran into thi problem and i sloved it.. it as tricky but the key is not in your code.. the key is in your virtual enviroment .. if u are not using a virtual environment then this anwser is not for you
1) Delete your virtual enviroment (first option)
2) look at your command line were your django server is ...
search your venv for this "0003_advertisements_alignedcourses_api_integration_appreciation_certificate_company_company_types_contrib.py"
if you find it just delete the migration folder that houses this file that all bruv
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | markothedev |
Solution 3 | markothedev |