Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python-dotenv #2

Merged
merged 1 commit into from Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
@@ -0,0 +1,2 @@
DEBUG=
SECRET_KEY=
4 changes: 4 additions & 0 deletions config/settings.py
@@ -1,5 +1,9 @@
import os

from dotenv import load_dotenv

load_dotenv()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вообще такие вещи помещаются в файл с запуском, например, в mange.py. Но на время разработки норм


Copy link
Contributor

@Safintim Safintim Sep 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может добавишь разграничение на продакшн и локальную БД? Также с env

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно!

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = os.getenv('SECRET_KEY', 'REPLACE_ME')
Expand Down
11 changes: 10 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -7,6 +7,7 @@ authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "^3.7"
django = "^2.2"
python-dotenv = "^0.10.3"

[tool.poetry.dev-dependencies]

Expand Down