我在Heroku中部署了一个简单的Django应用程序
步骤:
- git push heroku master
- heroku run python manage.py makemigrations ( or + app_name)
似乎影响了:
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))
然后我跑
- heroku run python manage.py migrate
但我收到了:
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.
答案 0 :(得分:4)
确保您已提交迁移文件。 然后运行
heroku run python manage.py migrate
请参阅此文档。
答案 1 :(得分:2)
您的迁移文件应该提交给您的源代码管理,并且永远不会在heroku上运行makemigrations
。
使用已提交的迁移文件,此问题将不再存在。
答案 2 :(得分:1)
根据documentation,Heroku文件系统是只读的。
这意味着当您从dyno断开连接时,makemigrations
命令创建的文件将被销毁。
要解决您的问题,您可以:
migrate
命令 - 推荐