mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-26 00:01:59 +08:00
31 lines
786 B
Python
31 lines
786 B
Python
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def main(argv=None, developer_mode: bool = False) -> None:
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weblate.settings")
|
|
|
|
from weblate.utils.management import WeblateManagementUtility
|
|
|
|
if argv is None:
|
|
argv = sys.argv
|
|
try:
|
|
# This is essentially Django's execute_from_command_line
|
|
utility = WeblateManagementUtility(argv=argv, developer_mode=developer_mode)
|
|
utility.execute()
|
|
except Exception:
|
|
try:
|
|
from weblate.utils.errors import report_error
|
|
|
|
report_error("Command failed")
|
|
except ImportError:
|
|
pass
|
|
raise
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|