Add django-environ and use it to set ALLOWED_HOSTS.

Signed-off-by: Eric Riggs <ericriggs42@gmail.com>
This commit is contained in:
Eric Riggs
2018-04-26 02:18:32 -04:00
parent d97b080586
commit 3145cb4231
4 changed files with 8 additions and 1 deletions

View File

@@ -16,10 +16,14 @@ import sys
from django.utils.translation import ugettext_lazy as _
import environ
import mayan
from .literals import DEFAULT_SECRET_KEY, SECRET_KEY_FILENAME, SYSTEM_DIR
env = environ.Env()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -33,7 +37,7 @@ SECRET_KEY = DEFAULT_SECRET_KEY
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '[::1]']
ALLOWED_HOSTS = env.list('MAYAN_ALLOWED_HOSTS', default=['127.0.0.1', 'localhost', '[::1]'])
# Application definition