From c891d1b19495ddd37f68b1ec31bb5c5e62e6db17 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Thu, 14 May 2015 02:19:00 +0200 Subject: [PATCH] Pridan externi django secret key soubor --- .gitignore | 3 +++ mamweb/settings.py | 4 +--- mamweb/settings_common.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d4924fc3..aefe158b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ # aux files *.pyc *.swp + +# secrets +/django.secret diff --git a/mamweb/settings.py b/mamweb/settings.py index 368ca53c..e1b17817 100644 --- a/mamweb/settings.py +++ b/mamweb/settings.py @@ -1,3 +1,4 @@ +import os.path from .settings_common import * # Local development settings @@ -10,9 +11,6 @@ INSTALLED_APPS += ( 'django_extensions', ) -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n' - # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 1d1fdda8..9012e13d 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -147,6 +147,16 @@ CKEDITOR_CONFIGS = { }, } + +# SECURITY WARNING: keep the secret key used in production secret! +# Create file 'django.secret' in every install (it is not kept in git) + +try: + with open(os.path.join(os.path.dirname(__file__), '..', 'django.secret')) as f: + SECRET_KEY = f.readline().strip() + except: + SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj' + # MaM specific SEMINAR_RESENI_DIR = os.path.join(BASE_DIR, 'media', 'reseni')