Skip to content

Commit 1f46df4

Browse files
authored
Use environment variables (#6)
* add django-environ to requirements.txt * created .env file * use env variables
1 parent 4402c16 commit 1f46df4

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

FoodProject/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECRET_KEY=c@mzjzz2yu&idjufq$4k(gl_p5%e4x0f(k7(4))qqt*1k5w2p7

FoodProject/settings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"""
1212

1313
import os
14+
import environ
15+
16+
17+
# Initialise environment variables
18+
env = environ.Env()
19+
environ.Env.read_env()
1420

1521
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1622
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -20,7 +26,7 @@
2026
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
2127

2228
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = 'c@mzjzz2yu&idjufq$4k(gl_p5%e4x0f(k7(4))qqt*1k5w2p7'
29+
SECRET_KEY = env('SECRET_KEY')
2430

2531
# SECURITY WARNING: don't run with debug turned on in production!
2632
DEBUG = True

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Django==3.1.7
33
Pillow==8.1.0
44
pytz==2021.1
55
sqlparse==0.4.1
6+
django-environ==0.11.2

0 commit comments

Comments
 (0)