Skip to content

Commit a49e9f8

Browse files
committed
On second thought, raising an exception if there isn't a dotenv is dumb.
1 parent 5fc02b7 commit a49e9f8

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

dotenv.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
import warnings
34

45
def read_dotenv(dotenv=None):
56
"""
@@ -12,10 +13,7 @@ def read_dotenv(dotenv=None):
1213
frame = sys._getframe()
1314
dotenv = os.path.join(os.path.dirname(frame.f_back.f_code.co_filename), '.env')
1415
if not os.path.exists(dotenv):
15-
raise EnvironmentError("%s doesn't exist. You may need to "
16-
"explicitly pass the path to .env to "
17-
"read_dotenv()." % dotenv)
18-
16+
warnings.warn("not reading %s - it doesn't exist." % dotenv)
1917
for k, v in parse_dotenv(dotenv):
2018
os.environ.setdefault(k, v)
2119

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = "django-dotenv",
55
description = "foreman reads from .env. manage.py doesn't. Let's fix that.",
6-
version = "1.0",
6+
version = "1.1",
77
author = "Jacob Kaplan-Moss",
88
author_email = "jacob@jacobian.org",
99
url = "http://github.com/jacobian/django-dotenv",

0 commit comments

Comments
 (0)