From 14486074b4c27c8e24aa7f3b525f3e637f00855b Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Tue, 28 Jan 2020 19:56:04 +0000 Subject: [PATCH] the server is running --- note_kfet/settings/__init__.py | 13 +++++++------ note_kfet/settings/production.py | 4 ++-- note_kfet/settings/secrets_example.py | 2 -- 3 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 note_kfet/settings/secrets_example.py diff --git a/note_kfet/settings/__init__.py b/note_kfet/settings/__init__.py index 550977cb..47e5bc1c 100644 --- a/note_kfet/settings/__init__.py +++ b/note_kfet/settings/__init__.py @@ -7,10 +7,11 @@ if app_stage == 'prod': from .production import * else: from .development import * -# Load password for database and SECRET_KEY -try: - from .secrets import * -except ImportError: - from .secrets_example.py import * - print("Use default secrets!") +# env variables set at the of in /env/bin/activate +# don't forget to unset in deactivate ! + +DATABASES["default"]["PASSWORD"] = os.environ.get('DJANGO_DB_PASSWORD','CHANGE_ME_IN_ENV_SETTINGS'); +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY','CHANGE_ME_IN_ENV_SETTINGS'); + + diff --git a/note_kfet/settings/production.py b/note_kfet/settings/production.py index c3283ad4..02c46ed2 100644 --- a/note_kfet/settings/production.py +++ b/note_kfet/settings/production.py @@ -10,10 +10,10 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql', + 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'note_db', 'USER': 'note', - 'PASSWORD': 'update_in_secrets.py', + 'PASSWORD': 'update_in_env_variable', 'HOST': '127.0.0.1', 'PORT': '', } diff --git a/note_kfet/settings/secrets_example.py b/note_kfet/settings/secrets_example.py deleted file mode 100644 index 3c7c4ac5..00000000 --- a/note_kfet/settings/secrets_example.py +++ /dev/null @@ -1,2 +0,0 @@ -DATABASES['default']['PASSWORD'] ='CHANGE_ME' -SECRET_KEY = 'CHANGE_ME'