Ben*_*Ben 13 python django heroku django-1.7 django-migrations
我最近在我的应用程序(UserProfile)中添加了一个模型,当我将更改推送到Heroku时,我想我不小心跑了heroku run python manage.py makemigrations.现在,当我尝试运行时,heroku run python manage.py migrate我得到以下错误
(leaguemaster) benjamins-mbp-2:leaguemaster Ben$ heroku run python manage.py migrate
Running `python manage.py migrate` attached to terminal... up, run.1357
Operations to perform:
Synchronize unmigrated apps: allauth
Apply all migrations: auth, admin, socialaccount, sites, accounts, account, contenttypes, sessions, leagueapp
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.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?请帮忙!
Bur*_*lid 36
您需要首先在本地创建迁移,将它们添加到存储库,使用新迁移提交文件,然后推送到heroku.
序列是这样的:
1. (add/modify some someapp/models.py)
2. python manage.py makemigrations someapp
3. python manage.py migrate
4. git add someapp/migrations/*.py (to add the new migration file)
5. git commit -m "added migration for app someapp"
6. git push heroku
7. heroku run python manage.py migrate
Run Code Online (Sandbox Code Playgroud)
$ python manage.py makemigrations && python manage.py migrate
Run Code Online (Sandbox Code Playgroud)
$ git add --all
Run Code Online (Sandbox Code Playgroud)
$ git commit -m "Fixed migrate error"
Run Code Online (Sandbox Code Playgroud)
$ git push heroku master
Run Code Online (Sandbox Code Playgroud)
$ heroku run python manage.py makemigrations
Run Code Online (Sandbox Code Playgroud)
$ heroku run python manage.py migrate
Run Code Online (Sandbox Code Playgroud)
您还必须确信您没有忽略您的迁移路径
.gitingnore
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12630 次 |
| 最近记录: |