import os
import sys

if __name__ == "__main__":
    if 'test' in sys.argv and '--tag=pkg' in sys.argv:
        settings = 'tola.settings.test_pkg'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif 'test':
        settings = 'tola.settings.test'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif os.environ.get("DJANGO_SETTINGS_MODULE"):
        settings = os.environ.get("DJANGO_SETTINGS_MODULE")
    else:
        settings = 'tola.settings.local'

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

import os
import sys

if __name__ == "__main__":
    if 'test' in sys.argv and '--tag=pkg' in sys.argv:
        settings = 'tola.settings.test_pkg'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif 'test' in sys.argv:
        settings = 'tola.settings.test'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif os.environ.get("DJANGO_SETTINGS_MODULE"):
        settings = os.environ.get("DJANGO_SETTINGS_MODULE")
    else:
        settings = 'tola.settings.local'

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

Fix bug running always with test config in dev
Fix bug running always with test config in dev

  import os
  import sys
  
  if __name__ == "__main__":
      if 'test' in sys.argv and '--tag=pkg' in sys.argv:
          settings = 'tola.settings.test_pkg'
          os.environ['DJANGO_SETTINGS_MODULE'] = settings
-     elif 'test':
+     elif 'test' in sys.argv:
          settings = 'tola.settings.test'
          os.environ['DJANGO_SETTINGS_MODULE'] = settings
      elif os.environ.get("DJANGO_SETTINGS_MODULE"):
          settings = os.environ.get("DJANGO_SETTINGS_MODULE")
      else:
          settings = 'tola.settings.local'
  
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)
  
      from django.core.management import execute_from_command_line
  
      execute_from_command_line(sys.argv)
  
Fix bug running always with test config in dev
## Code Before:
import os
import sys

if __name__ == "__main__":
    if 'test' in sys.argv and '--tag=pkg' in sys.argv:
        settings = 'tola.settings.test_pkg'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif 'test':
        settings = 'tola.settings.test'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif os.environ.get("DJANGO_SETTINGS_MODULE"):
        settings = os.environ.get("DJANGO_SETTINGS_MODULE")
    else:
        settings = 'tola.settings.local'

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

## Instruction:
Fix bug running always with test config in dev
## Code After:
import os
import sys

if __name__ == "__main__":
    if 'test' in sys.argv and '--tag=pkg' in sys.argv:
        settings = 'tola.settings.test_pkg'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif 'test' in sys.argv:
        settings = 'tola.settings.test'
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
    elif os.environ.get("DJANGO_SETTINGS_MODULE"):
        settings = os.environ.get("DJANGO_SETTINGS_MODULE")
    else:
        settings = 'tola.settings.local'

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings)

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)
