django.db.migrations.exceptions.NodeNotFoundError

前端 未结 5 1981
无人共我
无人共我 2020-12-07 01:00

When i run makemigrations command, i got this error:

Traceback (most recent call last):
 ...
django.db.migrations.exceptions.NodeNotFoundError:          


        
5条回答
  •  無奈伤痛
    2020-12-07 01:45

    If you open the migration file products.0002_auto_20160618_1143 you will see a section called dependencies:

    dependencies = [("products", "0001_initial")]
    

    Which will look like that. This line tell Django that the current file depends on that file. A file that given that error message isn't there. You can try commenting out that line and running the command again. Be aware that if one file is missing it's possible many are missing so you should reconcile your dependencies with what files you actually have.

    DISCLAIMER: If this is a production DB messing around with migration files can be dangerous if you don't know what you are doing. You should test this on a staging or dev server first (preferably one that has a snapshot you can restore to).

提交回复
热议问题