From 090d5b1fd4375eb3ea098de9c58d8d9a7263fa4e Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 5 Feb 2019 01:39:55 +0100 Subject: [PATCH] Add env file and related settings params --- app/settings.py | 18 ++++++++++-------- docker-compose.yml | 2 ++ env/debug.env | 31 +++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 env/debug.env diff --git a/app/settings.py b/app/settings.py index de467411..13019bd9 100644 --- a/app/settings.py +++ b/app/settings.py @@ -7,24 +7,26 @@ from django.core.urlresolvers import reverse_lazy sys.dont_write_bytecode = True -DEBUG = True +# Django settings for server project. +DEBUG = env('DEBUG') # False if not in os.environ TEMPLATE_DEBUG = DEBUG +ALLOWED_HOSTS = ['*'] + ADMINS = ( ('Guillaume Pellerin', 'webmaster@parisson.com'), - ('Lists', 'lists@parisson.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'teleforma', # Or path to database file if using sqlite3. - 'USER': 'teleforma', # Not used with sqlite3. - 'PASSWORD': 'HMYsrZLEtYeBrvER', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. + 'ENGINE': env('ENGINE'), # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'USER': env('MYSQL_USER'), # Not used with sqlite3. + 'PASSWORD': env('MYSQL_PASSWORD'), # Not used with sqlite3. + 'NAME': env('MYSQL_DATABASE'), + 'HOST': 'db', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. } } diff --git a/docker-compose.yml b/docker-compose.yml index 5b1af4df..6b2a8af5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,6 +39,8 @@ services: - db - borker - search + env_file: + - env/debug.env web: image: nginx diff --git a/env/debug.env b/env/debug.env new file mode 100644 index 00000000..77bc2b68 --- /dev/null +++ b/env/debug.env @@ -0,0 +1,31 @@ +## MYSQL DATABASE + +ENGINE=django.db.backends.mysql +MYSQL_ROOT_PASSWORD=mysecretpassword +MYSQL_DATABASE=teleforma +MYSQL_USER=teleforma +MYSQL_PASSWORD=mysecretpassword + +## DJANGO + +DEBUG=True +SECRET_KEY=ghv8us258zefoifh7n97dq&w$c((o5rj_$-9d-8j57y_a9og8wux1h7 + +## CELERY + +# replace broker by localhost if you start your app outside docker-compose +BROKER_URL=redis://broker:6379/0 + +# if this is True, all tasks will be executed locally by blocking until the task returns. +CELERY_ALWAYS_EAGER=False + +## HAYSTACK + +# if this is True, the search index will be rebuild +REINDEX=False + +HAYSTACK_URL=http://search:9200/ + +# change index names if hosting multiple search containers +HAYSTACK_INDEX_NAME=teleforma +HAYSTACK_INDEX_NAME_AUTOCOMPLETE=teleforma_auto -- 2.39.5