From 656934a0f3629b423e90478e54c8a385a6c1b7d9 Mon Sep 17 00:00:00 2001 From: Daniel Gray Date: Tue, 23 Jul 2024 15:54:32 +0200 Subject: [PATCH] updating environment variables - removed docker compose version not needed anymore - updated readme file --- .env.example | 1 + README.md | 17 ++++++++++++++++- docker-compose.yml | 9 +++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 436b34ff..3b276aba 100644 --- a/.env.example +++ b/.env.example @@ -18,3 +18,4 @@ EMAIL_HOST_USER='' EMAIL_HOST_PASSWORD='' EMAIL_BACKEND_CONSOLE='True/False' EMAIL_USE_TLS=True +SECRET_KEY='' diff --git a/README.md b/README.md index 5a1ea029..e9d6f3a5 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,20 @@ About the project: --- +### How to setup SECRET_KEY in Development + +.env file + +SECRET_KEY='' + +To generate a new secret key, you can use the following command: + +1. python3 manage.py shell +2. from django.core.management.utils import get_random_secret_key +3. print(get_random_secret_key()) + +--- + ### Using Makefile 1. Clone the repository @@ -34,7 +48,7 @@ About the project: .env file -* EMAIL_HOST='sandbo x.smtp.mailtrap.io' +* EMAIL_HOST='sandbo x.smtp.mailtrap.io' * EMAIL_HOST_USER='*********' * EMAIL_HOST_PASSWORD='******' * EMAIL_PORT='2525' @@ -75,4 +89,5 @@ Docker Volumes for production: ### Email Settings in Production .env file + * EMAIL_BACKEND_CONSOLE=False diff --git a/docker-compose.yml b/docker-compose.yml index b18cb7c9..358a4a87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,5 @@ -# This is is meant for local development, but should give an idea of what you +# This is meant for local development, but should give an idea of what you # can consider in production. -version: '3.8' services: db: @@ -32,15 +31,13 @@ services: extra_hosts: - "host.docker.internal:host-gateway" environment: - # TODO: dollar signs in the KEY are interpolated, therefore escaped here - # with double "$$". Maybe move to .env file to simplify? - - SECRET_KEY='django-insecure-w!h85bp^$$e8gm%c23r!0%9i7yzd=6w$$s&ic+6!%306&kj8@k*5' + - SECRET_KEY=${SECRET_KEY} - DEBUG=True - DB_HOST=db - DB_PORT=5432 - DB_NAME=term_db # see POSTGRES_DB above - DB_USER=sadilar # see POSTGRES_USER above - - DB_PASSWORD=sadilar # see POSTGRES_PASSWORD above + - DB_PASSWORD=${DB_PASSWORD} - TESTING_DIR=/app/general/tests/files/ - FEATURE_FLAG=search_feature - EMAIL_HOST=${EMAIL_HOST-}