background preloader

Actualités

Facebook Twitter

Django: Stop Writing Settings files — bruno.im. At this year's DjangoCon Europe I gave a Lightning talk titled "Stop Writing Settings Files". You can see the slides on SpeakerDeck. After the talk I got some interesting feedback. Some people disagree on some points for very valid reasons so I tought I'd write in more details what I was talking about. A historically famous pattern is the "local_settings trick": it simply consists in adding the following lines at the end of the project's settings: try: from local_settings import *except ImportError: pass This works combined with a local_settings.py that's kept out of source control and managed manually for development-specific or production-specific settings.

One issue with this technique is that it's hard to extend the base settings. To solve this problem, another pattern has emerged. . # settings/local.pyfrom .base import * INSTALLED_APPS += ( 'raven.contrib.django',) And with that you'd have a handful of settings files for each kind of environment: development, staging, production, etc. #! Technologie et société de la connaissance. Le dessous des cartes. mLyon - L'actualité du Grand Lyon. Actualités à la Une. Journal / Lyon Capitale - Lyon Capitale.