- February 15, 2008
- settings development deployment
- 6 (after 6 ratings)
I like to keep all local settings files in my versioning repository. The way I differentiate between them is by querying the hostname of the local machine. I've got a host_settings folder with local settings files. Notice that the local settings file names go by a convention where '.' is replaced with underscores.
1 2 3 4 5 6
try: import socket hostname = socket.gethostname().replace('.','_') exec "from host_settings.%s import *" % hostname except ImportError, e: raise e