PythonAnywhere Forums

Does this guide for git deployment also apply to existing web apps?

I already have a batch of existing web apps running and I have git version control running between my local machine and a remote repo. The only guide that I've seen is this one for git implementation, but it seems to be for starting from scratch. I just want to make sure I'm looking in the right direction before taking this step.

Thanks.

that link shows how to develop locally, then push to github, then have the pushed code automatically be updated on PythonAnywhere without you pulling it down manually.

if you want to do that, you can follow the guide. Otherwise, you can also just git clone and then git pull to update your code etc the exact same way you are using your local machine.

ie. think of pythonanywhere as just another local computer.

I've given this a lot of effort now, and following the instructions only seems to connect my computer to pythonanywhere. Nothing goes to the remote repository in between, which in this case, is bitbucket and not actually github. They're pretty identical in the end though.

Basically what I want is this: My computer --> Bitbucket --automatic--> pythonanywhere

What I'm getting is: My computer --> pythonanywhere

so you are saying when you push on your computer, it doesn't get updated on bitbucket but somehow automatically gets updated on pythonanywhere?

Yeah, I've gone through the instructions I don't even know how many times now and every time the end result is the skipping bitbucket. I get my initial push to bitbucket getting everything set up there, then I hook pythonanywhere, push to it, it asks for the password (I'll set up a key later) and the files get pushed. After that, any push after that goes straight to pythonanywhere. It's really doing my head in. I'm not a git expert by any means, but I understand the instructions and feel like I'm following them exactly.

If you've set the remote on your local machine (as described in the instructions), then you've removed bitbucket from the chain. In order to get it to work, you'll need to keep bitbucket as the remote for your local repo and then see if you can get bitbucket to have a remote of your bare repo on PythonAnywhere and then have a hook to push to PythonAnywhere when you push to it. I have no idea if bitbucket supports this, though. You'll have to work out how to do it from their docs.

Thanks, glenn. That has ultimately been the conclusion in the back of my head, but for some reason, I didn't want to accept it. It makes quite obvious sense really, but I took the instructions at face value too much I think. I saw a section in bitbucket's settings for a webhook option. I know bitbucket isn't your deal, but does that terminology seem accurate for what I'm trying to do?

Here's a screenshot - http://imgur.com/a/kW3lE

A webhook would be a URL you can tell bitbucket to hit when you push changes to it. That would only be useful if you set up a web app at the other end that listened to it and did something about it, which would involve a fair bit of coding.

It sounds to me like you want to be able to do "git push" for your deployments, but you don't want to lose the ability to push to github as well as pythonanywhere. Did you know you can set multiple remotes for a repository? You just name them whatever you like (the default, "origin", is just a default).

So you could set it up where

git push
# or
git push origin

sends your code to bitbucket, and

git push pythonanywhere

sends your code up to PA, and the does all the live deployment stuff as per the blog post.

I did not. That sounds incredibly easier. I'll give that a shot. Thanks!