From 7035ebccca7d2618f48fbc52d2de7b54fbc02bc6 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Thu, 19 May 2022 21:01:26 +0300 Subject: [PATCH 1/2] install python-dotenv --- poetry.lock | 17 ++++++++++++++++- pyproject.toml | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 92b7679..7c9d21a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -609,6 +609,17 @@ python-versions = "*" [package.dependencies] six = ">=1.5" +[[package]] +name = "python-dotenv" +version = "0.20.0" +description = "Read key-value pairs from a .env file and set them as environment variables" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "python-http-client" version = "3.3.7" @@ -828,7 +839,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "88bdaaa66bdcd3e1b59a1615b200c73587807ac8639cc32b8f56b5142c35aa14" +content-hash = "737b7278d4803532c7b5aee8fa95cabba24a20c70467d58fde5ab6d63c796ecf" [metadata.files] attrs = [ @@ -1196,6 +1207,10 @@ python-dateutil = [ {file = "python-dateutil-2.6.0.zip", hash = "sha256:3acbef017340600e9ff8f2994d8f7afd6eacb295383f286466a6df3961e486f0"}, {file = "python_dateutil-2.6.0-py2.py3-none-any.whl", hash = "sha256:537bf2a8f8ce6f6862ad705cd68f9e405c0b5db014aa40fa29eab4335d4b1716"}, ] +python-dotenv = [ + {file = "python-dotenv-0.20.0.tar.gz", hash = "sha256:b7e3b04a59693c42c36f9ab1cc2acc46fa5df8c78e178fc33a8d4cd05c8d498f"}, + {file = "python_dotenv-0.20.0-py3-none-any.whl", hash = "sha256:d92a187be61fe482e4fd675b6d52200e7be63a12b724abbf931a40ce4fa92938"}, +] python-http-client = [ {file = "python_http_client-3.3.7-py3-none-any.whl", hash = "sha256:ad371d2bbedc6ea15c26179c6222a78bc9308d272435ddf1d5c84f068f249a36"}, {file = "python_http_client-3.3.7.tar.gz", hash = "sha256:bf841ee45262747e00dec7ee9971dfb8c7d83083f5713596488d67739170cea0"}, diff --git a/pyproject.toml b/pyproject.toml index afa6dae..5367382 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ Pillow = "^9.1.1" sendgrid = "^6.7.0" sentry-sdk = "^1.4.3" django-polymorphic = "^3.1.0" +python-dotenv = "^0.20.0" [tool.poetry.dev-dependencies] coverage = "^5.5" From 913eb1cedf38f0d58aa732c287c4eb2ba5b4f622 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Thu, 19 May 2022 21:08:44 +0300 Subject: [PATCH 2/2] load .env file --- sikweb/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sikweb/settings.py b/sikweb/settings.py index b7386cd..e81d4de 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -10,10 +10,13 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ +from dotenv import load_dotenv import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration from sikweb.base import * +load_dotenv() # loads the configs from .env + SENTRY_DSN = os.getenv("SENTRY_DSN", "") DEPLOY_ENV = os.getenv("DEPLOY_ENV", "production")