Skip to content

Commit a71106e

Browse files
committed
.env
1 parent 166fe29 commit a71106e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

djangoStarter/.env

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
EMAIL_HOST = 'smtp.mailtrap.io'
2+
EMAIL_HOST_USER = ''
3+
EMAIL_HOST_PASSWORD = ''
4+
EMAIL_PORT = '2525'

djangoStarter/.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
EMAIL_HOST = 'smtp.mailtrap.io'
2+
EMAIL_HOST_USER = ''
3+
EMAIL_HOST_PASSWORD = ''
4+
EMAIL_PORT = '2525'

djangoStarter/settings.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
"""
1212

1313
from pathlib import Path
14+
from dotenv import load_dotenv
15+
import os
1416

17+
load_dotenv()
1518
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1619
BASE_DIR = Path(__file__).resolve().parent.parent
1720

1821

22+
1923
# Quick-start development settings - unsuitable for production
2024
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
2125

@@ -127,7 +131,7 @@
127131
CRISPY_TEMPLATE_PACK = 'bootstrap4'
128132

129133
EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
130-
EMAIL_HOST = 'smtp.mailtrap.io'
131-
EMAIL_HOST_USER = ''
132-
EMAIL_HOST_PASSWORD = ''
133-
EMAIL_PORT = '2525'
134+
EMAIL_HOST = os.getenv('EMAIL_HOST')
135+
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
136+
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
137+
EMAIL_PORT = os.getenv('EMAIL_HOST_PASSWORD')

0 commit comments

Comments
 (0)