2016-11-24 6 views
0

私はHerokuのherokuはどのようにpython manage.pyを移行するのですか?

ステップで簡単なDjangoアプリケーション展開:その後、私は

- heroku run python manage.py migrate 

を実行しますが、私は受け取っ

0002_main.py: 
- Create model Comment 
- Remove field status from match 
- Remove field quantity from slot 
- Add field avatar to account 
- Add field slots to match 
- Alter field verification_code on account 
- Alter field verification_code on slot 
- Add field match_object to comment 
- Add field user to comment 
- Alter index_together for comment (1 constraint(s)) 

影響しているように見える

- git push heroku master 

- heroku run python manage.py makemigrations (or + app_name) 

Running migrations: 
    No migrations to apply. 
    Your models have changes that are not yet reflected in a migration, and so won't be applied. 
    Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them. 

答えて

2

あなたの移行ファイルはあなたのソースコントロールにコミットされていて、決してherokuでmakemigrationsを実行しないでください。

コミット済みの移行ファイルでは、この問題は存在しなくなります。

+1

私は移行ファイルを見逃してしまった、私はちょうど英雄でmakemigrationsを走らせた –

1

Herokuファイルシステムは、documentationによると読み取り専用です。

これは、dynoから切断すると、makemigrationsコマンドで作成されたファイルが破棄されることを意味します。することができますあなたの問題を解決するために

  1. のGithub(またはあなたのソース管理システム)に移行ファイルをコミットして、Herokuのシェル上migrateコマンドを実行します - は、移行を作成
  2. をお勧めしますファイルを開き、heroku bash shellで移行を実行します。 - 生産には推奨されていません
3

コミット済みの移行ファイルがあることを確認してください。 then run

heroku run python manage.py migrate 

このドキュメントを参照してください。