Skip to content

Commit 56a479e

Browse files
committed
DEPS - Remove python-decouple Dependency
1 parent 6ea1f63 commit 56a479e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

core/settings.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,29 @@
33
Copyright (c) 2019 - present AppSeed.us
44
"""
55

6-
import os
7-
from decouple import config
6+
import os, random, string
7+
from dotenv import load_dotenv
88
from unipath import Path
99
import dj_database_url
1010

11+
load_dotenv()
12+
1113
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1214
BASE_DIR = Path(__file__).parent
1315
CORE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1416

1517
# SECURITY WARNING: keep the secret key used in production secret!
16-
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_1122')
18+
SECRET_KEY = os.environ.get('SECRET_KEY')
19+
if not SECRET_KEY:
20+
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ) for i in range( 32 ))
1721

1822
# SECURITY WARNING: don't run with debug turned on in production!
19-
DEBUG = config('DEBUG', default=True, cast=bool)
20-
DEVEL = config('DEVEL', default=True, cast=bool)
23+
DEBUG = os.getenv('DEBUG', False)
24+
DEVEL = os.getenv('DEVEL', False)
25+
SERVER = os.getenv('DEVEL', '127.0.0.1')
2126

2227
# load production server from .env
23-
ALLOWED_HOSTS = ['localhost', '127.0.0.1', config('SERVER', default='127.0.0.1')]
28+
ALLOWED_HOSTS = ['localhost', '127.0.0.1', SERVER]
2429

2530
# Application definition
2631

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pytz
66
sqlparse
77
Unipath
88
dj-database-url
9-
python-decouple
9+
python-dotenv
1010
gunicorn
1111
whitenoise
1212
Pillow

0 commit comments

Comments
 (0)