Commits

Olexiy Strashko committed 33f361f

Add fabric script to set up virtualenv

  • Participants
  • Parent commits c05e8f8

Comments (0)

Files changed (1)

+import os
+from fabric.api import local, lcd
+
+
+VIRTUAL_ENV_DIR = 'virtualenv'
+PROJECT_NAME = 'django-template-project'
+
+def get_virtual_env_bin(command):
+    path = os.path.join(VIRTUAL_ENV_DIR, PROJECT_NAME, 'bin')
+    if command:
+        path = os.path.join(path, command)
+    return path
+
+def create_virtualenv():
+    if not os.path.isdir(VIRTUAL_ENV_DIR):
+        os.mkdir(VIRTUAL_ENV_DIR)
+    with lcd(VIRTUAL_ENV_DIR):
+        local('virtualenv --distribute ' + PROJECT_NAME)
+    local(get_virtual_env_bin('pip') + ' install -r requirements.txt')
+
+
+