From 5e29c6313a09b3975e9f1961a310f4d4823b4cf6 Mon Sep 17 00:00:00 2001 From: Mikhail Yumanov Date: Sat, 13 Mar 2021 02:12:15 +0000 Subject: [PATCH] CST-10 znick#336 Moved db generator to deploy_local_beta --- anytask/generate_test_db.sh | 7 ------- deploy_local_beta/deploy_local_beta_python2.sh | 13 +++++-------- deploy_local_beta/generate_test_db.sh | 11 +++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) delete mode 100755 anytask/generate_test_db.sh create mode 100644 deploy_local_beta/generate_test_db.sh diff --git a/anytask/generate_test_db.sh b/anytask/generate_test_db.sh deleted file mode 100755 index 1620d05f7..000000000 --- a/anytask/generate_test_db.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -[[ -f sqlite3.db ]] && echo "sqlite3.db already exists!" && exit 1 - -./manage.py migrate --no-input -./manage.py createsuperuser --username=anytask --email=anytask@yandex.ru --noinput -echo 'from django.contrib.auth.models import User ; user=User.objects.get(username="anytask") ; user.set_password("pass") ; user.save() ; print "Password changed"' | ./manage.py shell --plain diff --git a/deploy_local_beta/deploy_local_beta_python2.sh b/deploy_local_beta/deploy_local_beta_python2.sh index dff131472..494614765 100644 --- a/deploy_local_beta/deploy_local_beta_python2.sh +++ b/deploy_local_beta/deploy_local_beta_python2.sh @@ -34,7 +34,6 @@ pip install -r requirements_local.txt ANYBETA_report ANYBETA_report "Manage django project" python setup.py develop -python ./anytask/manage.py migrate --noinput # CREATE DB @@ -42,13 +41,11 @@ python ./anytask/manage.py migrate --noinput ANYBETA_report ANYBETA_report "Create test database" -if test -e ./anytask/sqlite3.db -then - rm ./anytask/sqlite3.db -fi -./anytask/generate_test_db.sh -./anytask/manage.py create_test_data.sh - +$ANYBETA_DEPLOY/generate_test_db.sh +$ANYBETA_ROOT/anytask/manage.py create_test_data +ANYBETA_report +ANYBETA_report "Deploy completed!" +ANYBETA_report "You can now start django server using ${ANYBETA_ROOT}/anytask/manage.py runserver" fi diff --git a/deploy_local_beta/generate_test_db.sh b/deploy_local_beta/generate_test_db.sh new file mode 100644 index 000000000..6fe4f61ce --- /dev/null +++ b/deploy_local_beta/generate_test_db.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if test -e $ANYBETA_ROOT/sqlite3.db +then + rm $ANYBETA_ROOT/sqlite3.db +fi +$ANYBETA_ROOT/anytask/manage.py migrate --no-input +$ANYBETA_ROOT/anytask/manage.py createsuperuser --username=anytask --email=anytask@yandex.ru --noinput +echo 'from django.contrib.auth.models import User ; user=User.objects.get(username="anytask") ; user.set_password("pass") ; user.save() ; print "Password changed"' | $ANYBETA_ROOT/anytask/manage.py shell --plain + +ANYBETA_report "anytask pass"