我在几个月前使用FTP将Django 1.9项目部署到了Webfaction。不过,我想开始自动化部署过程,并设法将Webfaction上的现有部署链接到我的bitbucket回购。在Django服务器上迁移1.9失败
我的本地环境仍然正常工作,可以使迁移和迁移没有错误。但是,似乎过去的一些迁移并不完全匹配,所以当我对Webfaction进行git pull时,复制了额外的迁移。现在,我不能运行makemigrations或Webfaction迁移了 - 我得到的错误
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0016_auto_20161030_1228, 0003_auto_20161030_1638 in locations). To fix them run 'python manage.py makemigrations --merge
如果我运行此命令,我看到如下提示:
Merging locations
Branch 0016_auto_20161030_1228
- Add field added_by to location
- Change managers on location
- Add field latlng to location
- Add field address to location
- Alter field latitude on location
- Alter field longitude on location
- Alter field country on location
Branch 0003_auto_20161030_1638
- Add field added_by to location
- Change managers on location
- Add field address to location
- Add field latlng to location
- Alter field country on location
- Alter field latitude on location
- Alter field longitude on location`
Merging will only work if the operations printed above do not conflict
with each other (working on different fields or models)
Do you want to merge these migration branches? [y/N] Please answer yes or no:
我试图合并迁移,但然后在尝试迁移该列已存在后出现错误。
服务器上迁移文件:
0001_initial.py
0001_initial.pyc
0002_auto_20160416_1046.py
0002_auto_20160416_1046.pyc
0002_location_added_by.py
0002_location_added_by.pyc
0003_auto_20160416_1050.py
0003_auto_20160416_1050.pyc
0003_auto_20161030_1638.py
0003_auto_20161030_1638.pyc
0004_remove_location_category.py
0004_remove_location_category.pyc
0005_fun_nightlife_restaurant_shop.py
0005_fun_nightlife_restaurant_shop.pyc
0006_citycoverimage.py
0006_citycoverimage.pyc
0007_auto_20160416_1754.py
0007_auto_20160416_1754.pyc
0008_auto_20160416_1803.py
0008_auto_20160416_1803.pyc
0009_remove_location_reviews.py
0009_remove_location_reviews.pyc
0010_auto_20160422_1920.py
0010_auto_20160422_1920.pyc
0011_locationimage.py
0011_locationimage.pyc
0012_location_added_by.py
0012_location_added_by.pyc
0013_auto_20161029_1857.py
0013_auto_20161029_1857.pyc
0014_location_address.py
0014_location_address.pyc
0015_auto_20161030_1227.py
0015_auto_20161030_1227.pyc
0016_auto_20161030_1228.py
0016_auto_20161030_1228.pyc
__init__.py
__init__.pyc
当地移民文件:
0001_initial.py
0001_initial.pyc
0002_auto_20160228_1159.pyc
0002_auto_20160416_1046.py
0002_auto_20160416_1046.pyc
0002_location_reviews.pyc
0003_auto_20160416_1050.py
0003_auto_20160416_1050.pyc
0003_location_city.pyc
0004_auto_20160228_1255.pyc
0004_remove_location_category.py
0004_remove_location_category.pyc
0005_auto_20160228_1431.pyc
0005_fun_nightlife_restaurant_shop.py
0005_fun_nightlife_restaurant_shop.pyc
0006_citycoverimage.py
0006_citycoverimage.pyc
0006_location_category.pyc
0007_auto_20160304_2220.pyc
0007_auto_20160416_1754.py
0007_auto_20160416_1754.pyc
0008_auto_20160304_2221.pyc
0008_auto_20160416_1803.py
0008_auto_20160416_1803.pyc
0009_location_country.pyc
0009_remove_location_reviews.py
0009_remove_location_reviews.pyc
0010_auto_20160305_1505.pyc
0010_auto_20160422_1920.py
0010_auto_20160422_1920.pyc
0011_locationimage.py
0011_locationimage.pyc
0011_location_reviews.pyc
0012_location_added_by.py
0012_location_added_by.pyc
0013_auto_20161029_1857.py
0013_auto_20161029_1857.pyc
0014_location_address.py
0014_location_address.pyc
0015_auto_20161030_1227.py
0015_auto_20161030_1227.pyc
0016_auto_20161030_1228.py
0016_auto_20161030_1228.pyc
__init__.py
__init__.pyc
删除所有服务器迁移文件,做一个git拉那么我只有本地迁移文件没有工作。
我已阅读makemigrations --fake,但没有完全得到它,不知道这是否会有所帮助。
我知道本地db表(PostgreSQL)与Webfaction(也是PostgreSQL)中的表匹配。
宁愿不放弃我的产品。 D b。任何援助非常感谢。
您不应该在服务器上运行makemigrations。这是你在开发机器上做的事情。 –
嗨丹尼尔感谢您的答复。我现在意识到这是它出错的地方,用来在服务器上运行makemigrations。有关如何进行的任何建议? – Nick