def migration(): """ Integrate with south schema migration """ #activate env with cd('/'.join([deployment_root(),'env',env.project_fullname,'project',env.project_package_name,'sitesettings'])): #migrates all or specific env.migration venv = '/'.join([deployment_root(),'env',env.project_fullname,'bin','activate']) cmdpt1 = ' '.join(['source',venv,'&&']) sites = _get_django_sites() site_ids = sites.keys() site_ids.sort() for site in site_ids: for settings_file in _sitesettings_files(): site_settings = '.'.join([env.project_package_name,'sitesettings',settings_file.replace('.py','')]) cmdpt2 = ' '.join(["python manage.py migrate",env.migration]) if hasattr(env,"fakemigration"): cmdpt2 = ' '.join([cmdpt2,'--fake']) cmdpt2 = ''.join([cmdpt2,'--settings=',site_settings]) if env.verbosity: print " *", cmdpt2 output = sudo(' '.join([cmdpt1,cmdpt2]),user='******'% site) if env.verbosity: print output return
def sync_db(): """ Runs the django syncdb command """ with cd('/'.join([ deployment_root(), 'env', env.project_fullname, 'project', env.project_package_name, 'sitesettings' ])): venv = '/'.join([ deployment_root(), 'env', env.project_fullname, 'bin', 'activate' ]) sites = _get_django_sites() site_ids = sites.keys() site_ids.sort() for site in site_ids: for settings_file in _sitesettings_files(): site_settings = '.'.join([ env.project_package_name, 'sitesettings', settings_file.replace('.py', '') ]) if env.verbosity: print " * django-admin.py syncdb --noinput --settings=%s" % site_settings output = sudo(' '.join([ 'source', venv, '&&', "django-admin.py syncdb --noinput --settings=%s" % site_settings ]), user='******' % site) if env.verbosity: print output
def sync_db(): """ Runs the django syncdb command """ with cd('/'.join([deployment_root(),'env',env.project_fullname,'project',env.project_package_name,'sitesettings'])): venv = '/'.join([deployment_root(),'env',env.project_fullname,'bin','activate']) sites = _get_django_sites() site_ids = sites.keys() site_ids.sort() for site in site_ids: for settings_file in _sitesettings_files(): site_settings = '.'.join([env.project_package_name,'sitesettings',settings_file.replace('.py','')]) if env.verbosity: print " * python manage.py syncdb --noinput --settings=%s"% site_settings output = sudo(' '.join(['source',venv,'&&',"./manage.py syncdb --noinput --settings=%s"% site_settings]), user='******'% site) if env.verbosity: print output
def migration(): """ Integrate with south schema migration """ #activate env with cd('/'.join([ deployment_root(), 'env', env.project_fullname, 'project', env.project_package_name, 'sitesettings' ])): #migrates all or specific env.migration venv = '/'.join([ deployment_root(), 'env', env.project_fullname, 'bin', 'activate' ]) cmdpt1 = ' '.join(['source', venv, '&&']) sites = _get_django_sites() site_ids = sites.keys() site_ids.sort() for site in site_ids: for settings_file in _sitesettings_files(): site_settings = '.'.join([ env.project_package_name, 'sitesettings', settings_file.replace('.py', '') ]) cmdpt2 = ' '.join(["django-admin.py migrate", env.migration]) if hasattr(env, "fakemigration"): cmdpt2 = ' '.join([cmdpt2, '--fake']) cmdpt2 = ''.join([cmdpt2, '--settings=', site_settings]) if env.verbosity: print " *", cmdpt2 output = sudo(' '.join([cmdpt1, cmdpt2]), user='******' % site) if env.verbosity: print output return