Use os.path for the reset management command to support multiple platforms.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-22 09:32:29 -04:00
parent aae16346bd
commit f5768959d8
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from os import path
from django.apps import apps from django.apps import apps
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
@ -33,7 +35,7 @@ class Command(BaseCommand):
self.stdout.write(self.style.SUCCESS('Database flushed.')) self.stdout.write(self.style.SUCCESS('Database flushed.'))
for config in apps.app_configs.values(): for config in apps.app_configs.values():
if config.path.split('/')[-2] == 'babyblotter': if path.split(path.split(config.path)[0])[1] == 'babyblotter':
migrate = Migrate() migrate = Migrate()
options['app_label'] = config.name options['app_label'] = config.name
options['migration_name'] = 'zero' options['migration_name'] = 'zero'