Source

noodle-bucket / fabfile.py

import os
from fabric.api import *


SITE_NAME = 'noodlebucket'

def refresh_fixtures():
    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
    from django.conf import settings
    apps = [
        a.split('.')[-1] for a in settings.INSTALLED_APPS
        if a.startswith('%s.' % SITE_NAME)
    ]
    for app in apps:
        target_dir = os.path.join(app, 'fixtures')
        if not os.path.exists(target_dir):
            os.mkdir(target_dir)
        target = os.path.join(target_dir, 'initial_data.json')
        local('python manage.py dumpdata --indent=2 %s > %s' % (app, target))