0001-manage.py-try-to-use-local-configs-to-allow-quicksta.patch
| manage.py | ||
|---|---|---|
| 6 | 6 |
multitenant = False |
| 7 | 7 |
config_file = False |
| 8 | 8 | |
| 9 |
for i, arg in enumerate(sys.argv[1:]): |
|
| 10 |
if arg.startswith('-'):
|
|
| 9 |
argv = sys.argv[1:] |
|
| 10 |
for arg in list(argv): |
|
| 11 |
if arg.startswith('--'):
|
|
| 11 | 12 |
if arg.startswith('--config='):
|
| 12 | 13 |
config_file = arg.split('=')[1]
|
| 14 |
argv.pop(0) |
|
| 13 | 15 |
elif arg == '--multitenant': |
| 14 | 16 |
multitenant = True |
| 17 |
argv.pop(0) |
|
| 15 | 18 |
else: |
| 16 | 19 |
print >>sys.stderr, 'ERR: Unsupported flag', arg |
| 17 | 20 |
sys.exit(1) |
| 18 | 21 |
else: |
| 19 | 22 |
break |
| 23 | ||
| 20 | 24 |
if not config_file: |
| 21 |
print >>sys.stderr, 'ERR: No configuration file specified, use --config=/path/to/config.py' |
|
| 22 |
sys.exit(1) |
|
| 25 |
print >>sys.stderr, 'ERR: No configuration file specified' |
|
| 26 |
print >>sys.stderr, ' Syntax: manage.py --config=/path/to/config.py [--multitenant] command [...]' |
|
| 27 |
if os.path.exists('config.py'):
|
|
| 28 |
print >>sys.stderr, 'WARN: Using local config.py.' |
|
| 29 |
config_file = 'config.py' |
|
| 30 |
elif os.path.exists('config_example.py'):
|
|
| 31 |
print >>sys.stderr, 'WARN: Using config_example.py for quickstart.' |
|
| 32 |
config_file = 'config_example.py' |
|
| 33 |
else: |
|
| 34 |
sys.exit(1) |
|
| 23 | 35 | |
| 24 | 36 |
os.environ['DJANGO_CONFIG_FILE'] = config_file |
| 25 | 37 |
if multitenant: |
| ... | ... | |
| 29 | 41 | |
| 30 | 42 |
from django.core.management import execute_from_command_line |
| 31 | 43 | |
| 32 |
execute_from_command_line(sys.argv[:1] + sys.argv[i+1:]) |
|
| 44 |
execute_from_command_line(sys.argv[:1] + argv) |
|
| 33 |
- |
|