无需更改代码即可重新部署 Heroku 应用程序 [英] Redeploy Heroku app without code changes

查看:33
本文介绍了无需更改代码即可重新部署 Heroku 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署一个 Heroku 应用程序,该应用程序将使用 git push -u heroku master 理想地完成.但是,这仅在有任何待推送到 master 的未决提交时才有效.

I would like to deploy a Heroku app which will be done ideally using git push -u heroku master. However this will only work if there are any pending commits to be pushed to master.

如何在没有任何推送的情况下重新部署应用程序?我尝试了 git push -u heroku master -f 并且在下面仍然得到相同的结果

How can I redeploy the app while there is nothing to push ? I tried git push -u heroku master -f and still get the same below

Branch master set up to track remote branch master from heroku.
Everything up-to-date

PS:我也想保留现有的应用程序,这意味着我不能使用这个答案 https://stackoverflow.com/a/22043184/968442

PS: I also want to retain the existing app, which means I cannot make use of this answer https://stackoverflow.com/a/22043184/968442

推荐答案

通常设置配置变量会导致您的应用程序重新启动.在大多数情况下,执行此操作后应该不需要重新部署.

Normally setting a config var causes your application to be restarted. In most situations there should be no need to redeploy after doing this.

如果你真的需要触发一个新的部署,你可以添加一个新的空提交,然后再次推送到 Heroku:

If you really do need to trigger a new deployment you can add a new empty commit, then push to Heroku again:

git commit --allow-empty -m "Trigger Heroku deploy after enabling collectstatic"
git push heroku master

新的空提交是常规提交.它有一个哈希值、一个作者、一个时间戳等.它将与它的父级具有相同的树.这应该会导致 Heroku 使用与上一次提交相同的代码再次构建您的应用程序 slug.

The new empty commit is a regular commit. It has a hash, an author, a timestamp, etc. It will have the same tree as its parent. This should cause Heroku to build your app slug again using the same code as the previous commit.

这有点尴尬,但它有效.

It's a bit awkward, but it works.

这篇关于无需更改代码即可重新部署 Heroku 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆