I am working on a project on Django and I am facing an issue with it. I have done some migration wrong and decided to delete them from the project folder and rebuilt them. Since I did that Django is acting "like deleted one of its source files". The error occurs on every project I try to migrate
, makemigration
, runserver
. I tried to reinstall django with pip but it does not help at all. I also delete the .pyc
files but it did not help at all. I even generated new project but still ran on the same issue. I do think that is helpful but I have to mention that shell
launches OK.
The error
Performing system checks...
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1049a38c8>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 123, in inner_run
self.check_migrations()
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 427, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 267, in build_graph
raise exc
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/loader.py", line 241, in build_graph
self.graph.validate_consistency()
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/graph.py", line 243, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/graph.py", line 243, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/usr/local/lib/python3.6/site-packages/django/db/migrations/graph.py", line 96, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration admin.0003_auto_20180326_1230 dependencies reference nonexistent parent node ('profile', '0003_auto_20180326_1230')
It is acting very weird and I still can't understand what might have caused the issue.
Update
Using virtualenv
I managed to get it working. I set up virtualenv with python3
and I just ran makemigrations
and it worked like nothing had ever happened. So I guess it is something wrong with the source files. On the other hand I still can't find what is causing the issue.