startmisago.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. from optparse import make_option
  2. from django.core.management import call_command
  3. from django.core.management.base import BaseCommand, CommandError
  4. class Command(BaseCommand):
  5. """
  6. Builds Misago database from scratch
  7. """
  8. help = 'Install Misago to database'
  9. option_list = BaseCommand.option_list + (
  10. make_option('--quiet',
  11. action='store_true',
  12. dest='quiet',
  13. default=False,
  14. help='Dont display output from this message'),
  15. )
  16. def handle(self, *args, **options):
  17. if not options['quiet']:
  18. self.stdout.write('\nInstalling Misago to database...')
  19. if options['quiet']:
  20. call_command('syncdb', verbosity=0)
  21. call_command('migrate', verbosity=0)
  22. call_command('syncfixtures', quiet=1)
  23. else:
  24. call_command('syncdb')
  25. call_command('migrate')
  26. call_command('syncfixtures')
  27. if not options['quiet']:
  28. self.stdout.write('\nInstallation complete! Don\'t forget to run adduser to create first admin!\n')