Skip to content

Commit 279be8a

Browse files
committed
Also catch NameError exceptions in read_env
The django.conf.settings module could be successfully imported but the BASE_DIR constant could not be defined, which would raise a NameError. This small edit ensures that we're catching both potential failures.
1 parent b9a9dc2 commit 279be8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

environ/environ.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def read_env(cls, env_file=None, **overrides):
638638
try:
639639
from django.conf import settings
640640
env_file = os.path.join(settings.BASE_DIR, '.env')
641-
except ImportError:
641+
except (ImportError, NameError):
642642
logger.info(
643643
"%s doesn't exist - if you're not configuring your "
644644
"environment separately, create one." % env_file)

0 commit comments

Comments
 (0)