Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-19 Thread Vernon D. Cole
There is indeed a better way: Structured Settings. Turn the usual pattern of having settings.py import local_settings.py upside down. Call your specific setting (you can specify it be altering the DJANGO_SETTINGS_MODULE environment variable in your virtualenv activation script) and it will im

Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-18 Thread Mike Dewhirst
On 19/09/2013 3:59pm, Victor Hooi wrote: Hi, Hmm, in many cases there isn't really a sensible default (e.g. API keys or passwords). I was asking more in terms of - is this the "right" way of doing it in Django, or are people using some other technique to handle configuration you don't want in t

Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-18 Thread Victor Hooi
Hi, Hmm, in many cases there isn't really a sensible default (e.g. API keys or passwords). I was asking more in terms of - is this the "right" way of doing it in Django, or are people using some other technique to handle configuration you don't want in the repo? And is there a special excepti

Re: Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-18 Thread Dig
Hi, Do you means some thing like this? os.environ.get('SOME_VARIABLE', 'default_value') Regards, Dig On Sep 19, 2013 1:37 PM, "Victor Hooi" wrote: > Hi, > > I have several settings in my Django settings.py file that are specific > > Currently, I'm grabbing these from environment variables in

Using environment variables in settings.py - good practice? How to handle missing variables gracefully?

2013-09-18 Thread Victor Hooi
Hi, I have several settings in my Django settings.py file that are specific Currently, I'm grabbing these from environment variables in settings.py: import os > ... > # TODO - We need to gracefully catch if these aren't set. > SOME_VARIABLE = os.environ['SOME_VARIABLE'] This includes things l