try to read SECRET_KEY from environment (while allowing other methods for setting it later)

This commit is contained in:
Thomas Waldmann 2013-11-08 04:01:18 +01:00
parent c144e600ec
commit 26fca4ffcc

View File

@ -5,13 +5,20 @@ Django settings for nsupdate project
import os import os
import django.conf.global_settings as DEFAULT_SETTINGS import django.conf.global_settings as DEFAULT_SETTINGS
# Use a unique, long, random, secret string here.
SECRET_KEY = 'this is for sure not secret, but good enough for running the unit tests'
# set this to False for production (see the docs for important hints) # set this to False for production (see the docs for important hints)
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
# To make this work, put a unique, long, random, secret string into your environment.
# E.g. in ~/.bashrc: export SECRET_KEY="..."
try:
SECRET_KEY = os.environ['SECRET_KEY']
except KeyError:
# if there is no SECRET_KEY in the environment, it will be just undefined and
# Django will refuse running - except if you define it somehow else later (e.g. in
# a local_settings.py file that imports this file).
pass
# sender address for e.g. user activation emails # sender address for e.g. user activation emails
DEFAULT_FROM_EMAIL = "your_email@example.com" DEFAULT_FROM_EMAIL = "your_email@example.com"