Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/opencloud.spec b/opencloud.spec
index 4d72a55..5831006 100644
--- a/opencloud.spec
+++ b/opencloud.spec
@@ -1,7 +1,7 @@
 Summary: OpenCloud core services
 Name: opencloud
-Version: 1.0.25
-Release: 8
+Version: 1.0.26
+Release: 7
 License: GPL+
 Group: Development/Tools
 Source0: %{_tmppath}/%{name}-%{version}.tar.gz
@@ -29,7 +29,7 @@
 # Empty section.
 
 %pre
-#pip-python install django==1.5
+pip-python install django==1.7
 pip-python install djangorestframework
 pip-python install markdown  # Markdown support for the browseable API.
 pip-python install pyyaml    # YAML content-type support.
@@ -119,10 +119,9 @@
     echo "NEW INSTALL - initializing database"
     /opt/planetstack/scripts/opencloud initdb
 else
-    echo "UPGRADE - doing evolution"
+    # scripts/opencloud will choose evolve or migrate depending on django version
+    echo "UPGRADE - doing evolution/migration"
     /opt/planetstack/scripts/opencloud evolvedb
-    #echo "UPGRADE - doing migration"    
-    #/opt/planetstack/scripts/opencloud migratedb
 fi
 
 # start the server
diff --git a/planetstack/scripts/opencloud b/planetstack/scripts/opencloud
index ff6eefc..b307e66 100755
--- a/planetstack/scripts/opencloud
+++ b/planetstack/scripts/opencloud
@@ -134,15 +134,14 @@
     createdb
     syncdb
 fi
-if [ "$COMMAND" = "evolvedb" ]; then
+if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
     stopserver
     ensure_postgres_running
-    evolvedb
-fi
-if [ "$COMMAND" = "migratedb" ]; then
-    stopserver
-    ensure_postgres_running
-    migratedb
+    if [[ $DJANGO_17 ]]; then
+        migratedb
+    else
+        evolvedb
+    fi
 fi
 if [ "$COMMAND" = "resetdb" ]; then
     stopserver