简体   繁体   English

将现有的django git repo部署到heroku

[英]Deploy a pre existing django git repo to heroku

I have a DJango git repository.Me and some other developers are working on it and it has multiple branchs also. 我有一个DJango git仓库。我和其他一些开发人员正在开发它,它也有多个分支。 Now i want to deploy it to Heroku or want to use the heroku as a staging server means before pushing to git i want to push the code changes to heroku and if verified will push changes to git. 现在我想将其部署到Heroku或使用heroku作为登台服务器意味着在推送到git之前,我想将代码更改推送到heroku,如果验证通过,则将更改推送到git。 For this i have created a heroku app using this git repo by running 为此,我通过运行此git repo创建了一个heroku应用程序

heroku create 

command for heruku. 指挥heruku。 But the problem is when i make a commit it is directly committed to the git not to the heroku. 但是问题是当我进行提交时,它直接提交给git而不是heroku。

I have tried to delete the heroku app from the local git repo by running 我试图通过运行从本地git存储库中删除heroku应用

 `heroku apps:destroy –a guarded-tundra-1589 --confirm` 

but when i again tried to push the heroku master code is pushed to it. 但是当我再次尝试推送heroku主代码时,将其推送到了它。 means it doesn't get deleted. 表示它不会被删除。

Tell me the right way to deploy the project which already has a git repo to heroku. 告诉我正确的方法来将已经有git repo的项目部署到heroku。

There are standart Heroku commands to do this: 有标准的Heroku命令可以执行此操作:

$ heroku auth:login
... output omitted ...
$ heroku create --stack cedar
... output omitted ...
$ git commit -a -m 'Mods to run on Heroku.'
$ git push heroku master

UPDATE: 更新:

Also if you are planning to use Heroku in future it could be useful frt you to check their official Documentation - Getting Started with Django on Heroku 另外,如果您打算将来使用Heroku,则最好检查一下他们的官方文档-Heroku上的Django入门

This will delete your repo, but this what worked for me when I got that error. 这将删除您的存储库,但这在我收到该错误时对我有用。

rm -rf .git
git init 
git add .
git commit -m "First commit"
heroku create --stack cedar
git push heroku master

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

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