Skip to content

Instantly share code, notes, and snippets.

@mattupstate
Created July 24, 2011 20:12
Show Gist options
  • Save mattupstate/1103048 to your computer and use it in GitHub Desktop.
Save mattupstate/1103048 to your computer and use it in GitHub Desktop.
Django management command to convert all your apps to use South migrations
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
@cirosantilli
Copy link

where do you put his command? how does it see settings.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment