
import dotenv


from dotenv import load_dotenv, get_key, set_key, unset_key

def load_envs(path):
    import os
    path, _ = os.path.split(path)
    if path == '/':
        # bail out when you reach top of the FS
        load_dotenv(os.path.join(path, '.env'))
        return
    # load higher envs first
    # closer-to-base environments need higher precedence.
    load_envs(path)
    load_dotenv(os.path.join(path, '.env'))

Add `load_envs` to take a base path and recurse up, looking for .envs
Add `load_envs` to take a base path and recurse up, looking for .envs

  
- import dotenv
+ from dotenv import load_dotenv, get_key, set_key, unset_key
  
+ def load_envs(path):
+     import os
+     path, _ = os.path.split(path)
+     if path == '/':
+         # bail out when you reach top of the FS
+         load_dotenv(os.path.join(path, '.env'))
+         return
+     # load higher envs first
+     # closer-to-base environments need higher precedence.
+     load_envs(path)
+     load_dotenv(os.path.join(path, '.env'))
+ 
Add `load_envs` to take a base path and recurse up, looking for .envs
## Code Before:

import dotenv

## Instruction:
Add `load_envs` to take a base path and recurse up, looking for .envs
## Code After:

from dotenv import load_dotenv, get_key, set_key, unset_key

def load_envs(path):
    import os
    path, _ = os.path.split(path)
    if path == '/':
        # bail out when you reach top of the FS
        load_dotenv(os.path.join(path, '.env'))
        return
    # load higher envs first
    # closer-to-base environments need higher precedence.
    load_envs(path)
    load_dotenv(os.path.join(path, '.env'))
