2017-06-23 21:00:42 +00:00
|
|
|
#!/usr/bin/env python
|
2018-03-25 21:05:46 +00:00
|
|
|
import django
|
2017-06-23 21:00:42 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
2017-06-23 21:00:42 +00:00
|
|
|
if __name__ == "__main__":
|
2017-07-17 20:00:32 +00:00
|
|
|
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
2018-03-25 21:05:46 +00:00
|
|
|
# we're doing this here since otherwise, missing environment
|
|
|
|
# files in settings result in AttributeError being raised, generating
|
|
|
|
# a cryptic django.core.exceptions.AppRegistryNotReady error.
|
|
|
|
# To prevent that, we explicitely load settings here before anything
|
|
|
|
# else, so we fail fast with a relevant error. See #140 for more details.
|
|
|
|
django.setup()
|
2017-06-23 21:00:42 +00:00
|
|
|
|
|
|
|
from django.core.management import execute_from_command_line
|
|
|
|
|
2019-11-25 08:45:53 +00:00
|
|
|
if len(sys.argv) > 1 and sys.argv[1] in ["fw", "funkwhale"]:
|
|
|
|
# trigger our own click-based cli
|
|
|
|
from funkwhale_api.cli import main
|
|
|
|
|
|
|
|
sys.argv = sys.argv[1:]
|
|
|
|
main.invoke()
|
|
|
|
else:
|
|
|
|
execute_from_command_line(sys.argv)
|