- run('mkdir -p %(app_path)s' % env, pty=True)
- run('%(virtualenv)s %(app_path)s/ve' % env, pty=True)
- run('mkdir -p %(app_path)s/releases %(app_path)s/packages' % env, pty=True)
- run('cd %(app_path)s/releases; ln -sfT . current; ln -sfT . previous' % env, pty=True)
+ if not files.exists(env.app_path):
+ run('mkdir -p %(app_path)s' % env, pty=True)
+ with cd(env.app_path):
+ for subdir in 'releases', 'packages', 'log', 'samples':
+ if not files.exists(subdir):
+ run('mkdir -p %s' % subdir, pty=True)
+ # Install helper manage.py script into root dir.
+ if not files.exists('manage.py'):
+ with settings(full_django_root=get_django_root_path('current')):
+ upload_sample('manage.py', where='', ext='', mode=0755)
+ with cd('%(app_path)s/releases' % env):
+ if not files.exists('current'):
+ run('ln -sfT . current', pty=True)
+ if not files.exists('previous'):
+ run('ln -sfT . previous', pty=True)
+