From 228e46de35910d5caed504c48b71900fef1d2b8a Mon Sep 17 00:00:00 2001 From: Amin Alaee Date: Thu, 14 Jul 2022 18:39:28 +0200 Subject: [PATCH] Update docs for dotenv env_file not checking parent directories (#4150) --- docs/usage/settings.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/usage/settings.md b/docs/usage/settings.md index 3867add..ca0874c 100644 --- a/docs/usage/settings.md +++ b/docs/usage/settings.md @@ -148,6 +148,10 @@ In either case, the value of the passed argument can be any valid path or filena current working directory. From there, *pydantic* will handle everything for you by loading in your variables and validating them. +!!! note + If a filename is specified for `env_file`, Pydantic will only check the current working directory and + won't check any parent directories for the `.env` file. + Even when using a dotenv file, *pydantic* will still read environment variables as well as the dotenv file, **environment variables will always take priority over values loaded from a dotenv file**.