settings stuff

This commit is contained in:
Sanj 2011-12-08 02:52:03 +05:30
parent e9e159e412
commit fd3a5dffc3

View File

@ -63,8 +63,23 @@ MEDIA_URL = '/static/'
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = '#7w*kxhnvpvq)v0fj(%1+rqphvzmjp%i9xfi=4&%*3!*&(b#v2'
# Make this unique, creates random key first at first time.
try:
SECRET_KEY
except NameError:
SECRET_FILE = os.path.join(PROJECT_ROOT, '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)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
@ -102,3 +117,8 @@ INSTALLED_APPS = (
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
)
try:
import local_settings
except:
pass