<commit_before>import sys

from django.contrib.sites.models import Site
from django.conf import settings
from django.core.management.base import NoArgsCommand


from openedx.core.djangoapps.site_configuration.models import SiteConfiguration


class Command(NoArgsCommand):
    help = 'Create default SiteConfiguration for the default SITE_ID.'

    def handle_noargs(self, **options):
        s = Site.objects.get(id=settings.SITE_ID)

        try:
            if SiteConfiguration.objects.get(site=s).exists():
                print("Default SiteConfiguration already exists. Doing nothing.")
            else:
                sc = SiteConfiguration(
                    site=s,
                    enabled=True)
                sc.save()
                print("Created default SiteConfiguration.")
        except Exception as e:
            print("Failed to create default configuration. Error: {0}".format(str(e)))
            sys.exit(-1)
<commit_msg>Fixes site configuration management command<commit_after>import sys

from django.contrib.sites.models import Site
from django.conf import settings
from django.core.management.base import NoArgsCommand


from openedx.core.djangoapps.site_configuration.models import SiteConfiguration


class Command(NoArgsCommand):
    help = 'Create default SiteConfiguration for the default SITE_ID.'

    def handle_noargs(self, **options):
        s = Site.objects.get(id=settings.SITE_ID)

        try:
            if SiteConfiguration.objects.filter(site=s).exists():
                print("Default SiteConfiguration already exists. Doing nothing.")
            else:
                sc = SiteConfiguration(
                    site=s,
                    enabled=True)
                sc.save()
                print("Created default SiteConfiguration.")
        except Exception as e:
            print("Failed to create default configuration. Error: {0}".format(str(e)))
            sys.exit(-1)

{'fraction_non_alphanumeric': 0.08543489449305199, 'fraction_numerical': 0.002058672156459084, 'mean_word_length': 2.404553415061296, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1570505', 'n_tokens_mistral': 486, 'n_tokens_neox': 461, 'n_words': 130}