load local_settings.py
This commit is contained in:
parent
f157b4bd49
commit
c127fecd41
1 changed files with 25 additions and 3 deletions
|
@ -84,9 +84,6 @@ STATICFILES_FINDERS = (
|
||||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make this unique, and don't share it with anybody.
|
|
||||||
SECRET_KEY = 'gm!%-n#6$=hah**x9k9-%4dya$3-(q&4bowca+c24y3dijjd7i'
|
|
||||||
|
|
||||||
# List of callables that know how to import templates from various sources.
|
# List of callables that know how to import templates from various sources.
|
||||||
TEMPLATE_LOADERS = (
|
TEMPLATE_LOADERS = (
|
||||||
'django.template.loaders.filesystem.Loader',
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
@ -155,3 +152,28 @@ LOGGING = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#load installation specific settings from local_settings.py
|
||||||
|
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 = 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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue