Merge branch 'secret-secret-key' of https://github.com/Dunedan/binder into Dunedan-secret-secret-key

This commit is contained in:
jeffrey forman 2015-03-25 22:02:36 -04:00
commit cbd0716c8f
2 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
*.pyc
*.conf
*~
/binder/secret.txt

View File

@ -42,7 +42,18 @@ MEDIA_ROOT = os.path.join(SITE_ROOT, "files")
MEDIA_URL = "/files/"
STATIC_URL= "/static/"
SECRET_KEY = 'iuo-zka8nnv0o+b*7#_*fcep$@f^35=)c#7_20z6i8g0oc&r!g'
SECRET_FILE = os.path.join(SITE_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 = (