6

私はherokuサーバーで実行python manage.py makemigrationsし続けていますが、何回実行しても次のようになります:

$heroku run python manage.py makemigrations
Running `python manage.py makemigrations` attached to terminal... up, run.2680
Migrations for 'default':
  0002_auto_20141120_2007.py:
    - Alter field user on usersocialauth

そして、私が走るとheroku run python manage.py migrate

次のように返されます。

Running `python manage.py migrate` attached to terminal... up, run.1285
Operations to perform:
  Synchronize unmigrated apps: baflist_core, rest_framework, localflavor, storages
  Apply all migrations: admin, userAccount, contenttypes, sessions, default, location, messaging, forum, auth, posts
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
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.

確かに、私は postgres と移行が危険であるということしか知らないので、ここで質問することにしました。誰もこれに遭遇したことがありますか?

4

1 に答える 1

7

ローカル マイグレーションが完了すると、<your django app>/migrationsEx フォルダにマイグレーション ファイルが作成されます (restapi は私の django アプリケーションです)。

/Django/app/folder/restapi/migrations$ ls
0001_initial.py  0001_initial.pyc  __init__.py  __init__.pyc

したがって、移行ファイルを手動でコミットする必要があります。

heroku$ git commit restapi/migrations/0001_initial.py -m "migrations file"
heroku$ git push heroku master

注: いいえ heroku はアプリで自動的に移行を実行しません! 私はこれをチェックしました!ファイルをプッシュした後、アプリの移行を実行する必要があります。

heroku$ heroku run python manage.py migrate restapipython manage.py migrate restapi端末に接続して実行中... up, run.4602 実行する操作: すべての移行を適用: restapi 移行を実行中: restapi.0001_initial を適用中... OK

于 2014-12-09T12:17:17.467 に答える