From d3ade15c9ae2ebbf7cdb6d93926acd803ac9cb8f Mon Sep 17 00:00:00 2001 From: Aatish Neupane Date: Fri, 26 Oct 2018 14:55:13 +0545 Subject: [PATCH] add python decouple --- .env.sample | 2 ++ README.md | 3 ++- ipv6work/settings.py | 6 +++--- requirements.txt | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .env.sample diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..bea17eb --- /dev/null +++ b/.env.sample @@ -0,0 +1,2 @@ +DEBUG=True +ALLOWED_HOSTS=.localhost, .ipv6.work diff --git a/README.md b/README.md index 1c71a47..5a9702b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ docker build -t ipv6dotwork . -docker run -d -p 8000:8000 --name ipv6dotwork ipv6dotwork + +docker run -d -p 127.0.0.1:8001:8000 --name ipv6dotwork ipv6dotwork diff --git a/ipv6work/settings.py b/ipv6work/settings.py index 8dabe2b..f5e16ca 100644 --- a/ipv6work/settings.py +++ b/ipv6work/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os +from decouple import config, Csv # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -23,10 +24,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '+0t^onasc-b+_ry$!6@hpf4o79rw6m%q7dow5#ia+@nla&2@0-' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] +DEBUG = config('DEBUG', cast=bool, default=False) +ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv(), default="*") # Application definition diff --git a/requirements.txt b/requirements.txt index e4832e6..f130312 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ Django==2.1.2 django-crispy-forms==1.7.2 git+https://github.com/yourlabs/django-autocomplete-light.git#egg=django-autocomplete-light rules==2.0 +python-decouple==3.1