diff --git a/ponyconf/management/commands/addsite.py b/ponyconf/management/commands/addsite.py new file mode 100644 index 0000000..17c0a24 --- /dev/null +++ b/ponyconf/management/commands/addsite.py @@ -0,0 +1,13 @@ +from django.contrib.sites.models import Site +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + help = 'Add a site' + + def add_arguments(self, parser): + parser.add_argument('domain', type=str) + + def handle(self, *args, **options): + site = Site.objects.create(domain=options['domain'], name=options['domain']) + self.stdout.write(self.style.SUCCESS('Created site {}'.format(site)))