Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

a lot more information here https://code.djangoproject.com/wiki/SplitSettings

I typically use this set up:

- settings.py contains global settings that aren't effected by deployment level.

- at the bottom of that file you have

      try:
          from settings_local import *
      except:
          pass
- in settings_local.py you have your deployment level dependent settings

- then just git ignore settings_local.py



That's an

    except ImportError:
right? ;)


I've tried a few different strategies and found this method works best for me.

In my fabfile I have environment 'setters' that precede regular commands. So I can do 'fab qa deploy' or 'fab prod deploy' and the deploy command grabs the correct settings_local file for the target environment.


Even better than gitignoring your local_settings -

Save your local settings as settings_local.py.exmp and then

    ln -s settings_local.py.exmp settings_local.py
Giving you working local settings, and a versioned copy of them, that is useless unless linked properly.


I think you're missing an 's' there:

https://code.djangoproject.com/wiki/SplitSettings


opps, fixed.

Thanks




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: