import os
import sys


def main():
    # init is a special case, cause we want to add statirator.core to
    # INSTALLED_APPS, and have the command picked up. we'll handle it in here

    if 'init' in sys.argv:
        from django.conf import settings
        settings.configure(INSTALLED_APPS=('statirator.core', ))
    elif 'test' in sys.argv:
        os.environ.setdefault(
            "DJANGO_SETTINGS_MODULE", "statirator.test_settings")

    from django.core import management
    management.execute_from_command_line()


if __name__ == '__main__':
    main()

import os
import sys


def main():
    if 'test' in sys.argv:
        os.environ.setdefault(
            "DJANGO_SETTINGS_MODULE", "statirator.test_settings")
    else:
        from django.conf import settings
        settings.configure(INSTALLED_APPS=('statirator.core', ))

    from django.core import management
    management.execute_from_command_line()


if __name__ == '__main__':
    main()

Add statirator.core for all commands except test
Add statirator.core for all commands except test

  import os
  import sys
  
  
  def main():
-     # init is a special case, cause we want to add statirator.core to
-     # INSTALLED_APPS, and have the command picked up. we'll handle it in here
- 
-     if 'init' in sys.argv:
+     if 'test' in sys.argv:
+         os.environ.setdefault(
+             "DJANGO_SETTINGS_MODULE", "statirator.test_settings")
+     else:
          from django.conf import settings
          settings.configure(INSTALLED_APPS=('statirator.core', ))
-     elif 'test' in sys.argv:
-         os.environ.setdefault(
-             "DJANGO_SETTINGS_MODULE", "statirator.test_settings")
  
      from django.core import management
      management.execute_from_command_line()
  
  
  if __name__ == '__main__':
      main()
  
Add statirator.core for all commands except test
## Code Before:
import os
import sys


def main():
    # init is a special case, cause we want to add statirator.core to
    # INSTALLED_APPS, and have the command picked up. we'll handle it in here

    if 'init' in sys.argv:
        from django.conf import settings
        settings.configure(INSTALLED_APPS=('statirator.core', ))
    elif 'test' in sys.argv:
        os.environ.setdefault(
            "DJANGO_SETTINGS_MODULE", "statirator.test_settings")

    from django.core import management
    management.execute_from_command_line()


if __name__ == '__main__':
    main()

## Instruction:
Add statirator.core for all commands except test
## Code After:
import os
import sys


def main():
    if 'test' in sys.argv:
        os.environ.setdefault(
            "DJANGO_SETTINGS_MODULE", "statirator.test_settings")
    else:
        from django.conf import settings
        settings.configure(INSTALLED_APPS=('statirator.core', ))

    from django.core import management
    management.execute_from_command_line()


if __name__ == '__main__':
    main()
