Django迁移:“ 0001_initial.py”依赖错误

问题描述 投票:0回答:1

我刚刚开始从事使用Django的其他人的项目。

运行此序列后:

python manage.py makemigrations
python manage.py migrate
python manage.py runserver 127.0.0.1:8000

我收到错误:

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

migrations文件夹包含0002_auto_20171121_1034.py0003_auto_xxxxxxxx_xxxx.py0004_auto_xxxxxxxx_xxxx.py0005_auto_xxxxxxxx_xxxx.py0006_auto_xxxxxxxx_xxxx.py0007_auto_xxxxxxxx_xxxx.py

但是它不包含0001_initial.py

我尝试过的事情:

[1)我试图删除.pyc文件夹的所有migrations文件。

2)我试图删除这三行:

dependencies = [
    ('structures', '0001_initial'),
]

包含在0002_auto_20171121_1034.py中,但是这次,我得到了这个错误:

You have 6 unapplied migration(s). Your project may not work properly until you apply the migrations 
for app(s): structures.
Run 'python manage.py migrate' to apply them.

有没有人可以帮助您?

python django migration database-migration django-migrations
1个回答
0
投票

它可能随着添加或删除模型字段而上升。尝试上面的答案。


0
投票

它可能随着添加或删除模型字段而上升。尝试上面的答案。

© www.soinside.com 2019 - 2024. All rights reserved.