Skip to content

Commit 37e8c57

Browse files
committed
Remove 'import env' from settings.py
1 parent 2a66b99 commit 37e8c57

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

issue_tracker/settings.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212

1313
import os
1414
import dj_database_url
15-
import env
1615
from django.contrib.messages import constants as messages
1716

17+
if os.environ.get('DEVELOPMENT'):
18+
development = True
19+
else:
20+
development = False
21+
22+
1823
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1924
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2025

@@ -27,7 +32,7 @@
2732
'SECRET_KEY', 'r81y2+3y=qlb(=0-77rx3k07-8kqdqum5*rn@5a@j8ww194%5f')
2833

2934
# SECURITY WARNING: don't run with debug turned on in production!
30-
DEBUG = True
35+
DEBUG = development
3136

3237
ALLOWED_HOSTS = ['http://localhost:8000/',
3338
os.environ.get('HOSTNAME'),
@@ -85,22 +90,21 @@
8590

8691
WSGI_APPLICATION = 'issue_tracker.wsgi.application'
8792

88-
8993
# Database
9094
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
91-
92-
# sqlite3
93-
# DATABASES = {
94-
# 'default': {
95-
# 'ENGINE': 'django.db.backends.sqlite3',
96-
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
97-
# }
98-
# }
99-
100-
# postgresql
101-
DATABASES = {
102-
'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
103-
}
95+
if development:
96+
# sqlite3
97+
DATABASES = {
98+
'default': {
99+
'ENGINE': 'django.db.backends.sqlite3',
100+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
101+
}
102+
}
103+
else:
104+
# Postgresql
105+
DATABASES = {
106+
'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))
107+
}
104108

105109
# Password validation
106110
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

0 commit comments

Comments
 (0)