load local_settings
This commit is contained in:
parent
fd26a15db8
commit
fbdfa32765
2 changed files with 25 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@ www/
|
|||
*.swp
|
||||
venv
|
||||
*.swo
|
||||
secret.txt
|
||||
app/local_settings.py
|
||||
|
|
|
@ -19,9 +19,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-4^*01ba-twojkikte8_7q_%zc96f@i%^gwg-36*xlr1&l4w-im'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
|
@ -148,3 +145,26 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|||
TIMELINE_PREFIX = "https://aab21.pad.ma/"
|
||||
|
||||
URL_PREFIX = 'polis+'
|
||||
|
||||
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 = BASE_DIR / 'secret.txt'
|
||||
try:
|
||||
SECRET_KEY = open(SECRET_FILE).read().strip()
|
||||
except IOError:
|
||||
try:
|
||||
from django.utils.crypto import get_random_string
|
||||
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
|
||||
SECRET_KEY = get_random_string(50, chars)
|
||||
secret = open(SECRET_FILE, 'w')
|
||||
secret.write(SECRET_KEY)
|
||||
secret.close()
|
||||
except IOError:
|
||||
raise Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
|
||||
|
|
Loading…
Reference in a new issue