Code

Changes between Version 7 and Version 8 of SplitSettings


Ignore:
Timestamp:
01/05/10 04:48:18 (4 years ago)
Author:
glezos
Comment:

Add the multi-settings solution used by Transifex

Legend:

Unmodified
Added
Removed
Modified
  • SplitSettings

    v7 v8  
    262262# More development/maching specific settings 
    263263}}} 
     264 
     265== Using a list of conf files (Transifex) == 
     266 
     267[http://transifex.org/ Transifex] has adopted a solution using an ordered list of multiple `.conf` files inside a settings directory. This helps separating the config options, packaging in Linux distributions, and putting the settings files under `/etc`. 
     268 
     269{{{ 
     270$ ls settings/ 
     271 
     27210-base.conf 
     27320-engines.conf 
     27430-site.conf 
     275... 
     276 
     277$ cat settings.py 
     278 
     279import os.path 
     280import glob 
     281conffiles = glob.glob(os.path.join(os.path.dirname(__file__), 'settings', '*.conf')) 
     282conffiles.sort() 
     283for f in conffiles: 
     284    execfile(os.path.abspath(f)) 
     285}}} 
     286 
     287To apply local-only changes, create a `XX-local.conf file`, which can be ignored with your VCS of choice: 
     288 
     289{{{ 
     290$ cat settings/51-local.conf 
     291 
     292INSTALLED_APPS += ['debug_toolbar'] 
     293 
     294$ cat .hgignore 
     295 
     296syntax: glob 
     297settings/*-local.conf 
     298}}}