简体   繁体   English

使用对 github repo 的新提交更新 heroku django 部署的站点

[英]Updating heroku django deployed site with new commits to github repo

Say I have deployed a django website on heroku through a github repository.假设我通过 github 存储库在 heroku 上部署了一个 django 网站。 (For deployment I simply clicked on the deploy button here - https://github.com/AmmsA/theresumator#theresumator---using-django-resumator .) I now update the repository with new commits. (对于部署,我只需单击此处的部署按钮 - https://github.com/AmmsA/theresumator#theresumator---using-django-resumator 。)我现在使用新提交更新存储库。

Q: How can I make changes in the deployed website from the repository without losing the data already present on the repository.问:如何从存储库中更改已部署的网站,而不会丢失存储库中已经存在的数据。

When you are pushing the fresh commits git push heroku master or via git hook git push origin master -- these nothing to do with heroku database. 当您推送新的提交时git push heroku master或通过git hook git push origin master master-这些与heroku数据库无关。

But this will run this command when build python manage.py migrate so if you are changed something in the migrations definetly db schema get alter not the values stored in there. 但这将在构建python manage.py migrate migration时运行此命令,因此,如果您更改了迁移,则明确定义了数据库模式,而不是更改其中存储的值。

Just set your remote project:只需设置您的远程项目:

heroku git:remote -a heroku git:远程-a

And then, push your project on Heroku: git push heroku main然后,将您的项目推送到 Heroku: git push heroku main

I've written an article on it.我已经写了一篇关于它的文章。 You can see that.你可以看到。 https://medium.com/@sreebash/how-to-update-previous-deployed-project-on-heroku-c778d555cd8a https://medium.com/@sreebash/how-to-update-previous-deployed-project-on-heroku-c778d555cd8a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM