git://git.onelab.eu
/
plstackapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
run migrate for django 1.7 or evolve for django 1.5
[plstackapi.git]
/
planetstack
/
scripts
/
opencloud
diff --git
a/planetstack/scripts/opencloud
b/planetstack/scripts/opencloud
index
901ad80
..
b307e66
100755
(executable)
--- a/
planetstack/scripts/opencloud
+++ b/
planetstack/scripts/opencloud
@@
-7,6
+7,8
@@
fi
BACKUP_DIR=/opt/planetstack_backups
BACKUP_DIR=/opt/planetstack_backups
+DJANGO_17=`python -c "import django; from distutils.version import StrictVersion; print int(StrictVersion(django.get_version()) >= StrictVersion('1.7'))"`
+
cd /opt/planetstack
function ensure_postgres_running {
cd /opt/planetstack
function ensure_postgres_running {
@@
-44,6
+46,10
@@
function dropdb {
function syncdb {
echo "Syncing OpenCloud services..."
python /opt/planetstack/manage.py syncdb --noinput
function syncdb {
echo "Syncing OpenCloud services..."
python /opt/planetstack/manage.py syncdb --noinput
+ if [[ $DJANGO_17 ]]; then
+ echo "Loading initial data from fixture..."
+ python /opt/planetstack/manage.py loaddata /opt/planetstack/core/fixtures/initial_data.json
+ fi
}
function evolvedb {
echo "Evolving OpenCloud services..."
}
function evolvedb {
echo "Evolving OpenCloud services..."
@@
-128,15
+134,14
@@
if [ "$COMMAND" = "restoredb" ]; then
createdb
syncdb
fi
createdb
syncdb
fi
-if [ "$COMMAND" = "evolvedb" ]; then
- stopserver
- ensure_postgres_running
- evolvedb
-fi
-if [ "$COMMAND" = "migratedb" ]; then
+if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
stopserver
ensure_postgres_running
stopserver
ensure_postgres_running
- migratedb
+ if [[ $DJANGO_17 ]]; then
+ migratedb
+ else
+ evolvedb
+ fi
fi
if [ "$COMMAND" = "resetdb" ]; then
stopserver
fi
if [ "$COMMAND" = "resetdb" ]; then
stopserver