Upgraded script to be Django 1.7 friendly

fix_request_path_info
Chad Shryock 2014-09-16 22:10:48 -04:00
parent af4843e54b
commit e84a2072fc
1 changed files with 11 additions and 1 deletions

View File

@ -18,6 +18,10 @@ sys.stderr.write('Using Django version {0} from {1}\n'.format(
# Detect location and available modules # Detect location and available modules
module_root = dirname(realpath(__file__)) module_root = dirname(realpath(__file__))
test_runner = 'django.test.runner.DiscoverRunner'
if django.VERSION[:2] < (1, 6):
test_runner = 'django.test.simple.DjangoTestSuiteRunner'
# Inline settings file # Inline settings file
settings.configure( settings.configure(
DEBUG = False, # will be False anyway by DjangoTestRunner. DEBUG = False, # will be False anyway by DjangoTestRunner.
@ -43,8 +47,14 @@ settings.configure(
'polymorphic', 'polymorphic',
), ),
SITE_ID = 3, SITE_ID = 3,
TEST_RUNNER = test_runner,
MIDDLEWARE_CLASSES = (),
) )
if django.VERSION[:2] > (1, 6):
django.setup()
call_command('migrate', verbosity=1, interactive=False)
else:
call_command('syncdb', verbosity=1, interactive=False) call_command('syncdb', verbosity=1, interactive=False)