Making Django Projects Version Control Friendly

Subversion has been my friend ever since I learned about it. However, it took me a while to figure out how to deal with configuration files. For Django, this specifically relates to the

Django projects can end up on many different environments. Putting into source control directly will cause our settings to migrate across all working copies. This is not reasonable, as not every person will have the same environment (not all using mysql, not all using the same directory).

Removing from version control, and make a separate file that contains just the basic structure is a solution to that. However, it brings another problem: What if you want to change a used application or a middleware? You would then have to make that change on all working copies.

My solution has been to make a

This file has variables in it like media path, database information, and caching options. You can copy these things straight out of the (and delete them from

This file will go under version control.

Now, in your, add the line

from settings_local import *

(I added the line to the very bottom of my

So, now when a working copy of the project is grabbed, the person behind it can copy to Inside the environment’s details are placed. This file will be ignored from version control.

With this setup, you can add an application or middle ware to for easy distributing through version control, and it will not affect a workspace’s local variables.