updated settings to include local_settings

This commit is contained in:
sanj 2010-03-03 20:16:56 +05:30
parent 6a6a595321
commit f7d3c973c2

View File

@ -76,7 +76,7 @@ MEDIA_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/admin/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'fognneiw#s_o-#^tiny@^f-$x#1&29$3a37w5=kll57i!^uo@r'
# SECRET_KEY = 'fognneiw#s_o-#^tiny@^f-$x#1&29$3a37w5=kll57i!^uo@r'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
@ -123,3 +123,28 @@ INSTALLED_APPS = (
'debug_toolbar',
'sorl.thumbnail',
)
#overwrite default settings with local settings
try:
from local_settings import *
except ImportError:
pass
# Make this unique, creates random key first at first time.
try:
SECRET_KEY
except NameError:
SECRET_FILE = os.path.join(PROJECT_PATH, 'secret.txt')
try:
SECRET_KEY = open(SECRET_FILE).read().strip()
except IOError:
try:
from random import choice
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
secret = file(SECRET_FILE, 'w')
secret.write(SECRET_KEY)
secret.close()
except IOError:
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)