print '>>> install requirements'
require('release', provided_by=[deploy])
require('app_path')
- if not files.exists('%(app_path)s/ve' % env):
+ set_ve()
+ if not files.exists(env.ve):
# HERE: maybe venv?
require('virtualenv')
- run('%(virtualenv)s %(app_path)s/ve' % env, pty=True)
+ run('%(virtualenv)s %(ve)s' % env, pty=True)
with cd('%(app_path)s/releases/%(release)s' % env):
- run('%(app_path)s/ve/bin/pip install -r requirements.txt' % env, pty=True)
+ run('%(ve)s/bin/pip install -r %(reqs)s' % {'ve': env.ve, 'reqs': env.get('requirements_file', 'requirements.txt')}, pty=True)
with cd(get_django_root_path(env['release'])):
# Install DB requirement
database_reqs = {
}
databases = run(
'DJANGO_SETTINGS_MODULE=%(project_name)s.settings '
- '%(app_path)s/ve/bin/python -c \''
+ '%(ve)s/bin/python -c \''
'from django.conf import settings;'
'print(" ".join(set([d["ENGINE"] for d in settings.DATABASES.values()])))\'' % env)
for database in databases.split():
if database in database_reqs:
# TODO: set pip default pypi
- run('%(app_path)s/ve/bin/pip install ' % env + database_reqs[database])
+ run('%(ve)s/bin/pip install ' % env + database_reqs[database])
def copy_localsettings():
print '>>> migrate'
require('app_path', 'project_name')
with cd(get_django_root_path('current')):
- run('%(app_path)s/ve/bin/python manage.py syncdb --noinput' % env, pty=True)
+ run('%(ve)s/bin/python manage.py syncdb --noinput' % env, pty=True)
for app, migration in env.get('migrate_fake', ()):
- run('%s/ve/bin/python manage.py migrate %s --fake %s' % (env.app_path, app, migration), pty=True)
- run('%(app_path)s/ve/bin/python manage.py migrate' % env, pty=True)
+ run('%s/bin/python manage.py migrate %s --fake %s' % (env.ve, app, migration), pty=True)
+ run('%(ve)s/bin/python manage.py migrate' % env, pty=True)
def pre_collectstatic():
print '>>> pre_collectstatic'
return
require('app_path', 'project_name')
with cd(get_django_root_path('current')):
- run('%(app_path)s/ve/bin/python manage.py collectstatic --noinput' % env, pty=True)
-
+ run('%(ve)s/bin/python manage.py collectstatic --noinput' % env, pty=True)
def get_django_root_path(release):
require('app_path')
if 'django_root_path' in env:
path = join(path, env['django_root_path'])
return path
+
+def set_ve():
+ if 've' not in env:
+ env['ve'] = '%s/ve' % env.app_path