import os
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.conf import settings
from memopolis.models import User, Organization, Team, Map, Quest
[docs]
class Command(BaseCommand):
help = 'Check Memopolis configuration.'
[docs]
def handle(self, *args, **options):
self.stdout.write(self.style.MIGRATE_LABEL("\nMaking and applying django migrations..."))
call_command('makemigrations', 'memopolis')
call_command('makemigrations')
call_command('migrate')
self.stdout.write(self.style.MIGRATE_LABEL("\nMaking and compiling translation files..."))
for lang in settings.LANGUAGES:
locale = [lang[0].replace("-", "_"),]
if "en" in locale: continue
call_command('makemessages', locale=locale)
call_command('makemessages', domain="djangojs", locale=locale, verbosity=0)
call_command('compilemessages')
if os.path.isdir('/app/doc'):
self.stdout.write(self.style.MIGRATE_LABEL("\nGenerating sphinx documentation."))
os.system('cd /app/doc/ && make clean && make html')
self.stdout.write("\nConfig looks good.\n ")