import os

from fabric.api import local, env, execute, task, cd, run
from fabric.decorators import runs_once

@runs_once
def pre_deploy(branch=None):
    """
    Make sure that local.deploy.prep is only run
    once when the deploy command is run on multiple
    hosts.
    """

    execute('local.deploy.prep', branch=branch)

@task(hosts=[])
def deploy(branch=None):
    """
    Deploy this project.

    Internally calls local.deploy.prep once and then
    local.deploy.do for each host.

    Takes an optional branch argument that can be used
    to deploy a branch other than master.
    """

    pre_deploy(branch=branch)
    execute('local.deploy.do', branch=branch)

@task(hosts=[])
def migrate():
    """
    Database migration using south
    """

    project_dir = os.path.join(env.git_working_dir, 'project')
    exe_path = os.path.join(env.git_working_dir, 'env/bin')

    run('%s/python %s/manage.py migrate --all' %(exe_path, project_dir))

@@ -755,27 +755,25 @@
 %22%22%0A%0A    
-project_dir
+manage_py
  = os.pa
@@ -814,22 +814,37 @@
 ect'
-)%0A    exe_path
+, 'manage.py')%0A    python_exe
  = o
@@ -884,85 +884,81 @@
 'env
-/bin')%0A%0A    run('%25s/python %25s/manage.py migrate --all' %25(exe_path, project_dir
+', 'bin', 'python')%0A%0A    run('%25s %25s migrate --all' %25(python_exe, manage_py
 ))%0A

use join on all dirs/files