Files
web2.0-backend/setup.sh
T
2017-05-18 15:49:04 +03:00

58 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
echo "SIK WEB 2.0"
echo "This script will set up the environment for this project."
echo "========================================================="
echo "Dependencies: postgresql>9.5, python>3.5"
read -p "Are these programs installed? [y/n]" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Please install the dependencies. Exiting."
exit 0
fi
read -p "Create user 'sik' in postgres (needs sudo) [y/n]?" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo -u postgres psql < "$PWD/scripts/db/init.sql"
fi
read -p "Is virtualenv activated? [y/n]" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Please activate virtualenv first. Exiting."
exit 0
fi
read -p "Copy settings from template? [y/n]" -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
cp "$PWD/sikweb/settings-sample.py" "$PWD/sikweb/settings.py"
fi
read -p "Start setup? [y/n]" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Exiting."
exit 0
fi
(set -x; pip install -r requirements.txt)
(set -x; python manage.py migrate)
(set -x; python manage.py createdefaultadmin)
echo "Done."
echo "Run 'python manage.py runserver 0.0.0.0:8000' to start the development server!"