forked from lambdalisue/django-inspectional-registration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
35 lines (32 loc) · 1.13 KB
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# coding=utf-8
"""
Django 1.2 - 1.6 compatible manage.py
Modify this script to make your own manage.py
"""
__author__ = 'Alisue <lambdalisue@hashnote.net>'
import os
import sys
if __name__ == '__main__':
# add extra sys.path
root = os.path.abspath(os.path.dirname(__file__))
extra_paths = (root, os.path.join(root, 'src'))
for extra_path in extra_paths:
if extra_path in sys.path:
sys.path.remove(extra_path)
sys.path.insert(0, extra_path)
# set DJANGO_SETTINGS_MODULE
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings')
try:
# django 1.4 and above
# https://docs.djangoproject.com/en/1.4/releases/1.4/
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
except ImportError:
# check django version
import django
if django.VERSION[:2] >= (1.4):
# there are real problems on importing
raise
from django.core.management import execute_manager
settings = __import__(os.environ['DJANGO_SETTINGS_MODULE'])
execute_manager(settings)