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 like API keys, database IPs, database 
username/passwords, static file locations etc.

I then set these in the virtualenv activate script.

Is this a good practice in Django?

Also, is there a graceful way of catching when these aren't set? Currently, 
I'm using some of those settings variables in models.py, and it's failing 
silently. Should I put each os.environ call in a try/except block, or is 
there a more Pythonic way?

Cheers,
Victor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to