How to maintain django different settings both on server and Github
This question already has an answer here:
Using Git to keep different versions of a file locally vs. in the master repository
- Pull remote SVN and merge local changes
- Sharing git between different users
- Move a file in CVS without resetting the revision number
- Source Tree and Github not seeing all of my files
- Unable to pick specific commit using cherry-pick command
One Solution collect form web for “How to maintain django different settings both on server and Github”
What I’d suggest is to remove from your settings.py any settings that depend on where it is deployed. Put those settings into environment variables. For example:
STATIC_ROOT = os.environ.get('STATIC_ROOT')
then you need to set those environment variables before running the webserver.
STATIC_ROOT=`pwd`/static python manage.py runserver
On production depends on how you deploy, consult the documentation.
This principle of config into environment variables is exposed in the Twelve Factor App : http://www.12factor.net/config