2016-11-16 6 views
0

몇 달 전에 FTP를 사용하여 Webfaction에 Django 1.9 프로젝트를 배포했습니다. 그러나 배포 프로세스를 자동화하기를 원했고 Webfaction의 기존 배포를 bitbucket repo에 연결했습니다.django 서버 1.9 마이그레이션 실패

내 로컬 환경 변수가 여전히 정상적으로 작동하고 오류없이 마이그레이션 할 수 있습니다. 그러나 과거에 몇 가지 마이그레이션이 정확히 일치하지 않는 것으로 보였으므로 웹 프레임 작업을 수행 할 때 추가 마이그레이션이 복사되었습니다. - 지금은 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_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 

:

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 

마이그레이션 지역에있는 파일.

필자는 makemigrations --fake를 읽었지만 완전히 얻지는 못했고 도움이 될지 확실하지 않았다.

로컬 db 테이블 (PostgreSQL)이 Webfaction (또한 PostgreSQL)의 테이블과 일치한다는 것을 알고 있습니다.

내 제품을 삭제하지 않는 것이 좋습니다. db. 어떤 도움이라도 대단히 감사합니다.

+0

서버에서 makemigrations를 실행하지 않아야합니다. 그것은 당신이 당신의 dev 컴퓨터에서하는 일입니다. –

+0

안녕 다니엘 감사합니다. 이제는 서버에서 makemigrations를 실행하는 데 사용 된 것처럼 이것이 잘못되었다는 것을 깨달았습니다. 진행 방법에 대한 제안? – Nick

답변

0

그래,이 문제를 해결했습니다.

  1. manage.py dumpdata --exclude auth.permissions --exclude contenttypes> db.json
  2. : 경우 사람이 같은 문제로 실행, 이것은 서버에서 나를

    위해 일 것입니다 데이터베이스와 동일한 자격 증명을 사용하여 데이터베이스 리메이크 완전히

  3. 을 삭제
  4. manage.py의 migra (초기화 평 제외)
  5. 삭제 모든 마이그레이션 파일 테
  6. 자식 --hard HEAD에게
  7. manage.py loaddata의 db.json를 재설정 (잠시 소요)

지금 작동해야 . 시작하기 전에 리포가 최신 상태인지 확인하십시오.

관련 문제