import os
import sys

import environ

if __name__ == "__main__":
    if os.path.isfile('.env'):
        environ.Env.read_env('.env')
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

import os
import sys

import environ
ROOT_DIR = environ.Path(__file__) - 1

if __name__ == "__main__":
    if os.path.isfile(str(ROOT_DIR + '.env')):
        environ.Env.read_env(str(ROOT_DIR + '.env'))
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

Use full path in case the working dir is not the same
Use full path in case the working dir is not the same

  import os
  import sys
  
  import environ
+ ROOT_DIR = environ.Path(__file__) - 1
  
  if __name__ == "__main__":
-     if os.path.isfile('.env'):
+     if os.path.isfile(str(ROOT_DIR + '.env')):
-         environ.Env.read_env('.env')
+         environ.Env.read_env(str(ROOT_DIR + '.env'))
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
  
      from django.core.management import execute_from_command_line
  
      execute_from_command_line(sys.argv)
  
Use full path in case the working dir is not the same
## Code Before:
import os
import sys

import environ

if __name__ == "__main__":
    if os.path.isfile('.env'):
        environ.Env.read_env('.env')
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

## Instruction:
Use full path in case the working dir is not the same
## Code After:
import os
import sys

import environ
ROOT_DIR = environ.Path(__file__) - 1

if __name__ == "__main__":
    if os.path.isfile(str(ROOT_DIR + '.env')):
        environ.Env.read_env(str(ROOT_DIR + '.env'))
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)
