Sajid Ahmad
Sajid Ahmad

Reputation: 1144

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. 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. For this i have created a heroku app using this git repo by running

heroku create 

command for heruku. But the problem is when i make a commit it is directly committed to the git not to the heroku.

I have tried to delete the heroku app from the local git repo by running

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

but when i again tried to push the heroku master code is pushed to it. means it doesn't get deleted.

Tell me the right way to deploy the project which already has a git repo to heroku.

Upvotes: 1

Views: 247

Answers (2)

RustyShackleford
RustyShackleford

Reputation: 27278

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

Upvotes: 0

wolendranh
wolendranh

Reputation: 4292

There are standart Heroku commands to do this:

$ 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

Upvotes: 2

Related Questions