1#!/usr/bin/env python
2import os
3import sys
4
5from django.conf import settings
6import django
7
8DEFAULT_SETTINGS = dict(
9    INSTALLED_APPS=(
10        'model_utils',
11        'tests',
12    ),
13    DATABASES={
14        "default": {
15            "ENGINE": "django.db.backends.sqlite3"
16        }
17    },
18    SILENCED_SYSTEM_CHECKS=["1_7.W001"],
19)
20
21
22def run(command):
23    if not settings.configured:
24        settings.configure(**DEFAULT_SETTINGS)
25
26    parent = os.path.dirname(os.path.abspath(__file__))
27    appdir = os.path.join(parent, 'model_utils')
28    os.chdir(appdir)
29
30    from django.core.management import call_command
31
32    call_command('%smessages' % command)
33
34
35if __name__ == '__main__':
36    if (len(sys.argv)) < 2 or (sys.argv[1] not in {'make', 'compile'}):
37        print("Run `translations.py make` or `translations.py compile`.")
38        sys.exit(1)
39    run(sys.argv[1])
40