# HG changeset patch # User ymh # Date 1472731700 -7200 # Node ID e9cd38b7cfe085141048cc38fc9d6c6abd39f5e8 # Parent 11600deeaaee632e09219377127f2e23d116b173 improve install script + correct base settings diff -r 11600deeaaee -r e9cd38b7cfe0 sbin/sync/config.py.tmpl --- a/sbin/sync/config.py.tmpl Wed Aug 31 19:03:13 2016 +0200 +++ b/sbin/sync/config.py.tmpl Thu Sep 01 14:08:20 2016 +0200 @@ -6,7 +6,7 @@ env.web_group = 'www-data' env.folders = ['../run/log', 'static/media'] -env.repos = {'iconolab' : {'repo':"/Users/ymh/dev/projects/iconolab", 'src_root':'src', 'requirements': 'src/requirements/prod.txt'}, 'python_version': '3.5'} +env.repos = {'iconolab' : {'repo':"/Users/ymh/dev/projects/iconolab", 'src_root':'src', 'requirements': 'src/requirements/prod.txt', 'python_version': '3.5'}} env.base_export_path = "/tmp" env.export_prefix = "iconolab" env.key = 'iconolab' diff -r 11600deeaaee -r e9cd38b7cfe0 sbin/sync/fabfile.py --- a/sbin/sync/fabfile.py Wed Aug 31 19:03:13 2016 +0200 +++ b/sbin/sync/fabfile.py Thu Sep 01 14:08:20 2016 +0200 @@ -7,16 +7,18 @@ clean_export_folder, do_sync_comp, sync_install_build, do_create_virtualenv, clean_rsync_folder, rsync_export, get_src_version, sync_build, do_relaunch_server, install_build, do_create_virtualenv_requirement, build_src) -from fabric.api import task, env +from fabric.api import task, env, run, cd, put from fabric.colors import green +env.use_ssh_config = True + def build_source(version): print(green("build source with version %s" % version)) export_path = export_version(iconolab=version) export_path_full = os.path.join(export_path, env.key, env.repos[env.key]['src_root']) build_src(export_path_full) (_,version_str) = get_src_version(env.key, export_path_full) - return os.path.join(src_path,"dist","%s-%s.tar.gz" % (env.key,version_str)) + return os.path.join(export_path_full,"dist","%s-%s.tar.gz" % (env.key,version_str)) @task def relaunch_server(do_collectstatic=True, do_migrate=True, do_check_folder_access=False): @@ -27,9 +29,11 @@ def sync_site(version): print(green("sync site with version %s" % version)) build_path = build_source(version) + run('mkdir -p "%s"' % env.remote_path['build_export']) res_trans = sync_build(build_path) # untar build - run('tar zxf %s' % res_trans[0]) + with cd(env.remote_path['build_export']): + run('tar zxf %s' % res_trans[0]) # rebuild virtualenv requirements_path = os.path.join(res_trans[0][0:-7], env.repos[env.key]['requirements']) do_create_virtualenv_requirement(requirements_path, env.remote_path['virtualenv'], env.repos[env.key]['python_version']) diff -r 11600deeaaee -r e9cd38b7cfe0 src/iconolab/settings/__init__.py --- a/src/iconolab/settings/__init__.py Wed Aug 31 19:03:13 2016 +0200 +++ b/src/iconolab/settings/__init__.py Thu Sep 01 14:08:20 2016 +0200 @@ -226,4 +226,4 @@ IMG_JPG_DEFAULT_QUALITY = 80 -DJANGO_RUNSERVER = (sys.argv[1] == 'runserver') +DJANGO_RUNSERVER = (len(sys.argv)>1 and sys.argv[1] == 'runserver')