Commits

Anonymous committed 48f639e

added support for specifying SDK path via APP_ENGINE_SDK environment variable

Comments (0)

Files changed (2)

         # may be. First look within the project for a local copy, then look for
         # where the Mac OS SDK installs it.
         paths = [os.path.join(PROJECT_DIR, '.google_appengine'),
+                 os.environ.get('APP_ENGINE_SDK'),
                  '/usr/local/google_appengine',
                  '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine']
         for path in os.environ.get('PATH', '').split(os.pathsep):
         # Loop through all possible paths and look for the SDK dir.
         sdk_path = None
         for path in paths:
+            if not path:
+                continue
             path = os.path.realpath(path)
             if os.path.exists(path):
                 sdk_path = path
     # App Engine causes main.py to be reloaded if an exception gets raised
     # on the first request of a main.py instance, so don't call setup_project()
     # multiple times. We ensure this indirectly by checking if we've already
-    # modified sys.path.
+    # modified sys.path, already.
     if len(sys.path) < len(extra_paths) or \
             sys.path[:len(extra_paths)] != extra_paths:
-
         sys.path = extra_paths + sys.path
 
 # Add parent folder to sys.path, so we can import boot.
 # App Engine causes main.py to be reloaded if an exception gets raised
-# on the first request of a main.py instance, so don't add parent_dir multiple
+# on the first request of a main.py instance, so don't add project_dir multiple
 # times.
-parent_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
-if parent_dir not in sys.path:
-    sys.path.insert(0, parent_dir)
+project_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+if project_dir not in sys.path or sys.path.index(project_dir) > 0:
+    sys.path.insert(0, project_dir)
 
-# Remove the standard version of Django
+# Remove the standard version of Django.
 if 'django' in sys.modules and sys.modules['django'].VERSION < (1, 2):
     for k in [k for k in sys.modules
               if k.startswith('django\.') or k == 'django']:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.