<NME> set_default_site.py
<BEF> """
A simple managemenent command to update the default site.

See `https://docs.djangoproject.com/en/dev/ref/contrib/sites/`_.
"""
"""

from django.core.management.base import BaseCommand, CommandError
from django.db import connection

from django.contrib.sites.models import Site


class Command(BaseCommand):

    """Management command to set the default site."""

        parser.add_argument("hostname", type=str)

    def handle(self, *args, **options):
        """Command entry point."""
        if "hostname" not in options:
            raise CommandError("You must provide a hostname")
        site = Site.objects.get(pk=1)
        site.domain = args[0]
        site.name = args[0]
        site.save()
        connection.close()

<MSG> Fix attempt...

see #660

<DFF> @@ -6,12 +6,13 @@ See `https://docs.djangoproject.com/en/dev/ref/contrib/sites/`_.
 """
 
 from django.core.management.base import BaseCommand, CommandError
-from django.db import connection
 
 from django.contrib.sites.models import Site
 
+from . import CloseConnectionMixin
 
-class Command(BaseCommand):
+
+class Command(BaseCommand, CloseConnectionMixin):
 
     """Management command to set the default site."""
 
@@ -25,4 +26,3 @@ class Command(BaseCommand):
         site.domain = args[0]
         site.name = args[0]
         site.save()
-        connection.close()

Fix attempt...