2017-04-19 5 views
1

내 프로젝트의 루트 디렉토리에 bay라는 이름의 사용자 정의 응용 프로그램을 만들 수 있습니다를 실행하지 않는 고정 표시기로, 구조가 보인다장고 사용자 정의 응용 프로그램의 마이그레이션

postgres_1 | ERROR: relation "bay_brand" does not exist at character 13 
postgres_1 | STATEMENT: INSERT INTO "bay_brand" ("name") VALUES ('xyz') RETURNING "bay_brand"."id" 

따라서, 주어진 모델에 대한 마이그레이션이되지 않았습니다 실행 - 내 사용자 지정 응용 프로그램의 모델 중 하나, 나는 다음과 같은 오류가 발생합니다. 그래서, 난으로 마이그레이션 할 -

sudo docker-compose -f dev.yml run django python manage.py migrate 

가 실행이 있어야 bay.0001_initial 마이그레이션을 표시하지 않습니다

Postgres is up - continuing... 
Operations to perform: 
    Apply all migrations: account, admin, auth, contenttypes, sessions, sites, socialaccount, users 
Running migrations: 
    Applying contenttypes.0001_initial... OK 
    Applying contenttypes.0002_remove_content_type_name... OK 
    Applying auth.0001_initial... OK 
    Applying auth.0002_alter_permission_name_max_length... OK 
    Applying auth.0003_alter_user_email_max_length... OK 
    Applying auth.0004_alter_user_username_opts... OK 
    Applying auth.0005_alter_user_last_login_null... OK 
    Applying auth.0006_require_contenttypes_0002... OK 
    Applying auth.0007_alter_validators_add_error_messages... OK 
    Applying auth.0008_alter_user_username_max_length... OK 
    Applying users.0001_initial... OK 
    Applying account.0001_initial... OK 
    Applying account.0002_email_max_length... OK 
    Applying admin.0001_initial... OK 
    Applying admin.0002_logentry_remove_auto_add... OK 
    Applying sessions.0001_initial... OK 
    Applying sites.0001_initial... OK 
    Applying sites.0002_alter_domain_unique... OK 
    Applying sites.0003_set_site_domain_and_name... OK 
    Applying socialaccount.0001_initial... OK 
    Applying socialaccount.0002_token_max_lengths... OK 
    Applying socialaccount.0003_extra_data_default_dict... OK 
    Applying users.0002_auto_20170419_1104... OK 

명확 위의 결과있다. 그래서, 내가 가서

Postgres is up - continuing... 
Migrations for 'bay': 
    bay/migrations/0001_initial.py: 
    - Create model Brand 
    - Create model ... 
    - ... 

결과

sudo docker-compose -f dev.yml run django python manage.py makemigrations bay 

의 출력을보고 내가 다시 migrate 명령을 실행하려고하면, 그것은 No migrations to apply을 말한다.

답변

0

파일 사용 권한 문제라고 생각하는데 __init__.py 파일의 잠금 기호와 migrations 폴더의 __pycache__ 폴더에있는 잠금 기호를보고있었습니다. 기존 응용 프로그램의 migrations 폴더에있는 폴더와 비슷했기 때문에 처음에는 무시했지만 마이그레이션은 제대로 실행되었습니다.

는 내 사용자 지정 응용 프로그램에 migrations 폴더를 삭제 makemigrations 명령을 성공적으로 다음 migrate 실행 -

Postgres is up - continuing... 
Operations to perform: 
    Apply all migrations: account, admin, auth, bay, contenttypes, sessions, sites, socialaccount, users 
Running migrations: 
    Applying bay.0001_initial... OK 
관련 문제