diff -r bb6080bb6072 -r fc7cc9667de1 sbin/sync/fabfile.py --- a/sbin/sync/fabfile.py Fri Nov 30 02:41:10 2012 +0100 +++ b/sbin/sync/fabfile.py Fri Nov 30 03:18:40 2012 +0100 @@ -138,6 +138,11 @@ #remocve old files optio -c of collect static fail ! run("rm -fr \"%s\"" % (remotestaticsitepath)) run("python manage.py collectstatic --noinput") + +def syncdb(remotepath, remotevirtualenvpath): + activate_path = os.path.join(remotevirtualenvpath, "bin/activate") + with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath): + run("python manage.py syncdb --migrate --noinput") def create_config(export_path): print("Create config from %s" % (export_path,)) @@ -227,9 +232,11 @@ run("chown -R -c :%s \"%s\"" % (env.web_group, folder_path)) run("chmod -R -c g+w \"%s\"" % folder_path) @task -def relaunch_server(do_collectstatic=True): +def relaunch_server(do_collectstatic=True, do_syncdb=True): print("Relaunch server") check_folder_access() + if do_syncdb: + syncdb(env.remote_path['src'], env.remote_path['virtualenv']) if do_collectstatic: collectstatic(env.remote_path['src'], env.remote_path['virtualenv'], env.platform_web_module) sudo(env.web_relaunch_cmd, shell=False)