views:

124

answers:

2

I'm starting my first webapp, and I'm not sure how things typically are done. I'm using Django and Apache:

  1. How do you manage a source control repository? Do you check out to a separate folder, and then have a build script that copies files over? What exactly should be added to the repository? In other words, how do you make sure that you don't commit auto-generated files? (it's sometimes hard to tell what's auto-generated and what I just haven't figured out yet :)

  2. How do I first deploy to a private development page, and then deploy to the main page when ready? Can I set up two servers? If so, how?

I know these are kinda newbie questions, but I can't seem to find a good tutorial that really explains these fundamental issues.

+2  A: 

I would have a development copy which would be a checkout from my repository. On the live site I would have exports (as opposed to checkouts) of tagged versions and I would name the directory these exports are in with the tag name "project-v1.4.5" for example. I would then have a symlink to point to the currently active tag. This allows you to go back to an older version a lot more easily if you find problems after going live with a new tag.

If you're using SVN I recommend you read (http://svnbook.red-bean.com/) the SVN book's sections on Fundamental Concepts and Tags (in the Branching and Merging chapter).

SVN allows you to ignore files you don't want committing http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.ignore.html

StephenPaulger
Good answer. I've always wondered though why people are picky about using exports rather than checkouts on the live server. Is it a holdover from PHP et al, where webapp code lives in a live webroot? Otherwise I really can't see why it matters (I use checkouts without any issues, FWIW).
Carl Meyer
One reason to use an export rather than a checkout is that it discourages editing on the live site, which is usually A-Bad-Thing TM. Another reason is if you're backing up your live site, which I hope you are, .svn directories take up 379MB of a 891MB checkout I'm using currently.
StephenPaulger
A: 

with git you can set up a private branch and have selected files persist in that branch only (for example - to maintain your local configs and templates). I've asked a similar question before. With this setup updating your app and pushing your changes to the public branch is trivial.

Evgeny