manage.py 711 Bytes
Newer Older
Patrick's avatar
Patrick committed
1 2 3 4
#!/usr/bin/env python
import os
import sys

Patrick's avatar
Patrick committed
5

Patrick's avatar
Patrick committed
6
if __name__ == "__main__":
Patrick's avatar
Patrick committed
7 8 9

    os_environ = "DJANGO_SETTINGS_MODULE"
    project = os.path.split(os.path.abspath(os.path.dirname(__file__)))[-1]
10 11 12 13
    # Settings are set according to directory name
    # Assume developement environment by default
    if project == 'repanier':
        project = 'mysite'
Patrick's avatar
Patrick committed
14 15 16 17 18
    django_settings = "%s.common_settings" % project
    os.environ.setdefault(os_environ, django_settings)
    if os.environ.get(os_environ) != django_settings:
        os.environ.pop(os_environ)
        os.environ.setdefault(os_environ, django_settings)
Patrick's avatar
Patrick committed
19 20 21

    from django.core.management import execute_from_command_line

22
    execute_from_command_line(sys.argv)