 (defun locate-django-project ()
   "Look for Django project."
 
-  (do-if
-   (locate-file "manage.py"
-                (mapcar (lambda (item) (concat (getenv "PROJECTROOT") item))
-                        '("" "/server/src")))
-   (lambda (path) (replace-regexp-in-string "manage\.py$" "" path))))
+  (when (getenv "PROJECTROOT")
+    (do-if
+     (locate-file "manage.py"
+                  (mapcar (lambda (item) (concat (getenv "PROJECTROOT") item))
+                          '("" "/server/src")))
+     (lambda (path) (replace-regexp-in-string "manage\.py$" "" path)))))
 
 
 (defun add-django-to-env (env)

(defun look-for-virtualenv (subdirectory)
  "Look for python virtualenv inside SUBDIRECTORY."

    (when (directory-files (getenv "PROJECTROOT")
                           nil
                           (concat "^" subdirectory "$"))


        (message (concat "[ENVIRONMENT] Detected python virtualenv at "
                         virtualenv))
        virtualenv))))


(defun enable-virtualenv ()
