summaryrefslogtreecommitdiffstats
path: root/authentic2-ctl
blob: ee2fef05d47500bb1b56d9d8a5c3b2895d392e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
import os
import sys
import authentic2.logger

if __name__ == "__main__":
    config_file = False

    argv = sys.argv[1:]
    if argv and argv[0].startswith('--config='):
        config_file = argv[0].split('=')[1]
        argv.pop(0)

    if config_file:
        os.environ['AUTHENTIC2_SETTINGS_FILE'] = config_file

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentic2.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv[:1] + argv)