+ if not files.exists('%(app_path)s/ve' % env):
+ require('virtualenv')
+ run('%(virtualenv)s %(app_path)s/ve' % 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)
+ with cd(get_django_root_path(env['release'])):
+ # Install DB requirement
+ database_reqs = {
+ 'django.db.backends.postgresql_psycopg2': 'psycopg2',
+ 'django.db.backends.mysql': 'MySQL-python',
+ }
+ databases = run('''DJANGO_SETTINGS_MODULE=%(project_name)s.settings %(app_path)s/ve/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])
+