Reputation: 6832
Some of the programs I'm working on are developed in different environments (different OS, different databases). What I learned from "Two Scoops of Django" for example, is to avoid local settings. What I want to do is to set up a settings file that imports the local variables like database credentials and such.
What is the best practice to do so? I had a look at the ConfigParser module which would work for me but maybe there are other solutions out there? I will be glad if someone shares his/her experience!
Upvotes: 0
Views: 104
Reputation: 1068
The way that I do it, and the same way that the popular Django CMS Mezzanine does it is like so:
try:
from local_settings import *
except ImportError:
pass
Then in a local_settings.py
file in the same directory, put all your database settings/sensitive info/etc.
Upvotes: 1