diff --git a/bin/compile b/bin/compile
index 01ae6aa69e0aeea40ad92d5c94a6b615968edab4..a2baaf0389e6a9b72fb5ee80206503bcf759b66c 100755
--- a/bin/compile
+++ b/bin/compile
@@ -2,8 +2,7 @@
 
 # Usage:
 #
-#     $ bin/compile <build-dir> <cache-dir>
-
+#     $ bin/compile <build-dir> <cache-dir> <env-path>
 
 # Fail fast and fail hard.
 set -eo pipefail
@@ -16,6 +15,8 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
 ROOT_DIR=$(dirname $BIN_DIR)
 BUILD_DIR=$1
 CACHE_DIR=$2
+ENV_FILE=$3
+
 
 CACHED_DIRS=".heroku"
 
@@ -222,7 +223,7 @@ puts-step "Installing dependencies using Pip ($PIP_VERSION)"
 
 # Django collectstatic support.
 bpwatch start collectstatic
-  source $BIN_DIR/steps/collectstatic
+  sub-env $BIN_DIR/steps/collectstatic
 bpwatch stop collectstatic
 
 # ### Finalize
@@ -261,6 +262,6 @@ bpwatch start anvil_appdir_commit
   if [ "$SLUG_ID" ]; then
     deep-mv $TMP_APP_DIR $APP_DIR
   fi
-bpwatch stop anvil_appdir_commit
 
+bpwatch stop anvil_appdir_commit
 bpwatch stop compile
diff --git a/bin/steps/hooks/post_compile b/bin/steps/hooks/post_compile
index a5f4c5a224162a578a268895a7b0732ca61d1226..e4afc09e98b788c7d4cb980676a3f1f407cbeae4 100644
--- a/bin/steps/hooks/post_compile
+++ b/bin/steps/hooks/post_compile
@@ -3,5 +3,5 @@
 if [ -f bin/post_compile ]; then
     echo "-----> Running post-compile hook"
     chmod +x bin/post_compile
-    bin/post_compile
+    sub-env bin/post_compile
 fi
\ No newline at end of file
diff --git a/bin/steps/hooks/pre_compile b/bin/steps/hooks/pre_compile
index e5eeddf55e0bedbb62d074df099bbbaaa6708447..86c706b6574e1dbf63f99bc8ff838d80a4653b61 100644
--- a/bin/steps/hooks/pre_compile
+++ b/bin/steps/hooks/pre_compile
@@ -3,5 +3,5 @@
 if [ -f bin/pre_compile ]; then
     echo "-----> Running pre-compile hook"
     chmod +x bin/pre_compile
-    bin/pre_compile
+    sub-env bin/pre_compile
 fi
\ No newline at end of file
diff --git a/bin/utils b/bin/utils
index ce7f63249ad42a3c5e73b153460b97d61c03bff1..f1e3e6b967f1fe3c5593d0f79e07c9b93e8ea70c 100755
--- a/bin/utils
+++ b/bin/utils
@@ -59,4 +59,6 @@ function deep-rm (){
   find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
 }
 
-
+function sub-env (){
+   (export $(egrep -v '^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)' $ENV_FILE); $1)
+}