1 2 3 4 5 6 7 8 9 10 11 12 | import socket, platform
hostname = socket.gethostname().replace('.','_').replace('-', '_')
try:
import os
path = "settings_files/%s.py" % hostname
path = os.path.join(os.path.dirname(__file__), path)
execfile(path)
except ImportError, e:
import sys
sys.stderr.write("Unable to read settings_files/%s.py\n" % hostname)
sys.exit(1)
|
More like this
- local_settings override for project settings by Magus 3 years, 11 months ago
- Paths in Django settings relative to settings.py by zejn 4 years, 3 months ago
- django log by maplye 4 years, 11 months ago
- Different approach to local settings.py by jokull 3 years, 12 months ago
- Save image in field by grillermo 1 month ago
Comments
A variation:
Lets you use shorter names - for example, mysite.py for mysite.com.au, or www_mysite.py for www.mysite.com.
#