Created
July 24, 2011 20:12
-
-
Save mattupstate/1103048 to your computer and use it in GitHub Desktop.
Django management command to convert all your apps to use South migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import settings | |
from django.core.management.base import BaseCommand | |
from subprocess import call | |
class Command(BaseCommand): | |
def _is_project_app(self, app_name): | |
return not 'django' in app_name and not 'south' in app_name | |
def handle(self, *args, **options): | |
try: | |
call(['./manage.py', 'syncdb']) | |
for app in settings.INSTALLED_APPS: | |
if self._is_project_app(app): | |
call(['./manage.py', 'convert_to_south', app]) | |
print 'All applications converted to south' | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where do you put his command? how does it see settings.py?